1{* Display the list of available translations for an object and manage its translations *} 2{** Currently works for the following object types: 'article' and 'wiki page' **} 3{strip} 4{if empty($submenu) || $submenu neq 'y'} 5 <div class="btn-group"> 6 {if $prefs.lang_available_translations_dropdown neq 'y' } 7 {* For all object types: First show the translate icon and on hover the language of the current object *} 8 {if ! $js}<ul class="cssmenu_horiz"><li>{/if} 9 <a href="#" class="btn btn-info btn-sm dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" title="{tr}Translations{/tr}"> 10 {icon name="translate"} 11 </a> 12 {else} 13 <div class="dropdown"> 14 {* For all object types: Show everything as a dropdown for visibility *} 15 {if ! $js}<ul class="cssmenu_horiz"><li>{/if} 16 <button class="btn btn-info btn-sm dropdown-toggle" data-toggle="dropdown" data-hover="dropdown"> 17 {icon name="translate"} {$trads[0].langName|escape} ({$trads[0].lang|escape}) 18 </button> 19 {/if} 20{else} 21 {if ! $js}<ul class="cssmenu_horiz"><li>{/if} 22 <a tabindex="-1" href="#"> 23 {icon name="translate"} {tr}Translation...{/tr} 24 </a> 25{/if} 26 {* ..than on hover first show the list of translations including the current language highlighted *} 27 {if empty($trads[0].lang)} 28 <div class="dropdown-menu dropdown-menu-right" role="menu"> 29 <h6 class="dropdown-header"> 30 {tr}Translations{/tr} 31 </h6> 32 <div role="separator" class="dropdown-divider"></div> 33 <div class="dropdown-item"> 34 <em>{tr}No language assigned{/tr}</em> 35 </div> 36 <div role="separator" class="dropdown-divider"></div> 37 {if $object_type eq 'wiki page' and ($tiki_p_edit eq 'y' or (!$user and $prefs.wiki_encourage_contribution eq 'y')) and !$lock} 38 <a class="dropdown-item" href="tiki-edit_translation.php?page={$page|escape}"> 39 {tr}Set page language{/tr} 40 </a> 41 {elseif $object_type eq 'article' and $tiki_p_edit_article eq 'y'} 42 <a class="dropdown-item" href="tiki-edit_article.php?articleId={$articleId|escape}"> 43 {tr}Set article language{/tr} 44 </a> 45 <div role="separator" class="dropdown-divider"></div> 46 {/if} 47 </div> 48 {else} 49 <div class="dropdown-menu dropdown-menu-right" role="menu"> 50 <h6 class="dropdown-header"> 51 {tr}Translations{/tr} 52 </h6> 53 <div role="separator" class="dropdown-divider"></div> 54 {* First the language of the object *} 55 {if $object_type eq 'wiki page'} 56 <a href="tiki-index.php?page={$trads[0].objName|escape:url}&no_bl=y" class="dropdown-item tips selected" title="{tr}Current language:{/tr} {$trads[0].objName}"> 57 <em>{$trads[0].langName|escape} ({$trads[0].lang|escape})</em> 58 </a> 59 {elseif $object_type eq 'article'} 60 <a href="tiki-read_article.php?articleId={$trads[0].objId}" title="{tr}Current language:{/tr} {$trads[0].objName}" class="dropdown-item tips selected"> 61 <em>{$trads[0].langName|escape} ({$trads[0].lang|escape})</em> 62 </a> 63 {/if} 64 {* Show the list of available translations *} 65 {section name=i loop=$trads} 66 {* For wiki pages *} 67 {if $object_type eq 'wiki page' and $trads[i] neq $trads[0]} 68 <a href="tiki-index.php?page={$trads[i].objName|escape}&no_bl=y" title="{tr}View:{/tr} {$trads[i].objName}" class="dropdown-item tips {$trads[i].class}"> 69 {$trads[i].langName|escape} ({$trads[i].lang|escape}) 70 </a> 71 {/if} 72 {* For articles *} 73 {if $object_type eq 'article' and $trads[i] neq $trads[0]} 74 <a href="tiki-read_article.php?articleId={$trads[i].objId}" title="{tr}View:{/tr} {$trads[i].objName}" class="dropdown-item tips {$trads[i].class}"> 75 {$trads[i].langName|escape} ({$trads[i].lang|escape}) 76 </a> 77 {/if} 78 {/section} 79 {* For wiki pages only: Show a link to view all translations on a single page *} 80 {if $object_type eq 'wiki page' and $prefs.feature_multilingual_one_page eq 'y' and $translationsCount gt 1} 81 <div role="separator" class="dropdown-divider"></div> 82 <a href="tiki-all_languages.php?page={$trads[0].objName|escape:url}&no_bl=y" title=":{tr}Show all translations of this page on a single page{/tr}" class="dropdown-item tips"> 83 {tr}All languages{/tr} 84 </a> 85 {/if} 86 {* For wiki pages only: List of machine translation candidates if feature is switched on *} 87 {if $object_type eq 'wiki page' and $prefs.feature_machine_translation eq 'y'} 88 <div role="separator" class="dropdown-divider"></div> 89 <h6 class="dropdown-header"> 90 {tr}Machine translations{/tr} 91 </h6> 92 {* List machine translation candidates for available language of the site *} 93 {foreach from=$langsCandidatesForMachineTranslation item=mtl} 94 <a href="tiki-index.php?machine_translate_to_lang={$mtl.lang|escape}&page={$page|escape:"quotes"}&no_bl=y" title="{$mtl.langName|escape} ({$mtl.lang|escape})" class="dropdown-item tips"> 95 {$mtl.langName|escape} * 96 </a> 97 {/foreach} 98 {/if} 99 {* Translation maintenance *} 100 {capture} 101 {if $object_type eq 'wiki page' and $tiki_p_edit eq 'y'} 102 <div role="separator" class="dropdown-divider"></div> 103 <a class="dropdown-item tips" href="tiki-edit_translation.php?page={$trads[0].objName|escape:url}&no_bl=y" title=":{tr}Translate page{/tr}"> 104 {tr}Translate{/tr} 105 </a> 106 <a href="{bootstrap_modal controller=translation action=manage type='wiki page' source=$page}" class="dropdown-item attach_detach_translation tips" data-object_type="wiki page" data-object_id="{$page|escape:'quotes'}" title=":{tr}Manage page translations{/tr}"> 107 {tr}Manage translations{/tr} 108 </a> 109 {elseif $object_type eq 'article' and $tiki_p_edit_article eq 'y'} 110 <div role="separator" class="dropdown-divider"></div> 111 <a class="dropdown-item" href="tiki-edit_article.php?translationOf={$articleId}" title="{tr}Translate article{/tr}"> 112 {tr}Translate{/tr} 113 </a> 114 <a href="{bootstrap_modal controller=translation action=manage type=article source=$articleId}" class="dropdown-item attach_detach_translation tips" data-object_id="{$articleId|escape:'quotes'}" data-object_type="article" title="{tr}Manage article translations{/tr}"> 115 {tr}Manage translations{/tr} 116 </a> 117 {/if} 118 {/capture} 119 {if !empty($smarty.capture.default)}{* Only display the header if there's content *} 120 {$smarty.capture.default} 121 {/if} 122 </div> 123 {/if} 124 {if ! $js}</li></ul>{/if} 125{if empty($submenu) || $submenu neq 'y'} 126 {if $prefs.lang_available_translations_dropdown eq 'y' } 127 </div> 128 {/if} 129 </div> 130{/if} 131{/strip} 132