1{* $Id$ *} 2{title admpage="i18n"}{tr}Edit languages{/tr}{/title} 3<div class="t_navbar mb-4"> 4 {if $smarty.session.interactive_translation_mode eq 'on'} 5 {button href="tiki-interactive_trans.php?interactive_translation_mode=off" _text="{tr}Turn off interactive translation{/tr}" _ajax="n"} 6 {else} 7 {button href="tiki-interactive_trans.php?interactive_translation_mode=on" _text="{tr}Turn on interactive translation{/tr}" _ajax="n"} 8 {/if} 9 <a class="btn btn-link tips" href="{service controller=language action=manage_custom_translations}" title="{tr}Customized String Translation{/tr}:{tr}Manage local translations in a custom.php file{/tr}"> 10 {icon name="file-code-o"} {tr}Custom Translations{/tr} 11 </a> 12 <a class="btn btn-link tips" href="{service controller=language action=upload language={$edit_language}}" title="{tr}Upload Translations{/tr}:{tr}Upload a file with translations for the selected language.{/tr}"> 13 {icon name="upload"} {tr}Upload Translations{/tr} 14 </a> 15</div> 16<form action="tiki-edit_languages.php" id="select_action" method="post"> 17 {if isset($find)} 18 <input type="hidden" name="find" value="{$find}"> 19 {/if} 20 {if isset($maxRecords)} 21 <input type="hidden" name="maxRecords" value="{$maxRecords}"> 22 {/if} 23 <div class="adminoptionbox"> 24 <div class="form-group row"> 25 <label for="edit_language" class="col-md-3 col-form-label">{tr}Language{/tr}</label> 26 <div class="col-md-6"> 27 <select id="edit_language" class="translation_action form-control" name="edit_language"> 28 {section name=ix loop=$languages} 29 <option value="{$languages[ix].value|escape}" {if $edit_language eq $languages[ix].value}selected="selected"{/if}>{$languages[ix].name}</option> 30 {/section} 31 </select> 32 </div> 33 <div class="col-md-3"> 34 <a class="btn btn-link tips" href="{service controller=language action=download language={$edit_language} file_type=language_php}" title="{tr}Download{/tr}:{tr}Download language.php file for the selected language.{/tr}"> 35 {icon name="download"} 36 </a> 37 <a class="btn btn-link tips" href="{service controller=language action=download_db_translations language={$edit_language}}" title="{tr}Download Database Translations{/tr}:{tr}Download a file with all the translations in the database for the selected language.{/tr}"> 38 {icon name="file-text-o"} 39 </a> 40 <a class="btn btn-link tips" href="{bootstrap_modal controller=language action=write_to_language_php language={$edit_language}}" title="{tr}Write to language.php{/tr}:{tr}Translations in the database will be merged with the other translations in language.php for the selected language.{/tr}"> 41 {icon name="flash"} 42 </a> 43 </div> 44 </div> 45 </div> 46 <div class="adminoptionbox"> 47 <div class="form-group row"> 48 <label for="add_tran_sw" class="col-md-4 col-form-label">{tr}Add a translation{/tr}</label> 49 <div class="col-md-8"> 50 <input id="add_tran_sw" class="translation_action" type="radio" name="action" value="add_tran_sw" {if $action eq 'add_tran_sw'}checked="checked"{/if}> 51 </div> 52 </div> 53 </div> 54 <div class="adminoptionbox"> 55 <div class="form-group row"> 56 <label for="edit_rec_sw" class="col-md-4 col-form-label">{tr}Untranslated strings{/tr}</label> 57 <div class="col-md-8"> 58 <input id="edit_rec_sw" class="translation_action" type="radio" name="action" value="edit_rec_sw" {if $action eq 'edit_rec_sw'}checked="checked"{/if}> 59 {if $prefs.record_untranslated eq 'y'} 60 <div class="adminoptionboxchild form-check"> 61 <label class="form-check-label"><input id="only_db_untranslated" class="form-check-input translation_action" type="checkbox" name="only_db_untranslated" {if $only_db_untranslated eq 'y'}checked="checked"{/if}>{tr}Show only database stored untranslated strings{/tr}</label> 62 </div> 63 {/if} 64 </div> 65 </div> 66 </div> 67 <div class="adminoptionbox"> 68 <div class="form-group row"> 69 <label for="edit_tran_sw" class="col-md-4 col-form-label">{tr}Edit translations{/tr}</label> 70 <div class="col-md-8"> 71 <input id="edit_tran_sw" class="translation_action" type="radio" name="action" value="edit_tran_sw" {if $action eq 'edit_tran_sw'}checked="checked"{/if}> 72 <div class="adminoptionboxchild form-check"> 73 <label class="form-check-label"><input id="only_db_translations" class="translation_action form-check-input" type="checkbox" name="only_db_translations" {if $only_db_translations eq 'y'}checked="checked"{/if}>{tr}Show only database stored translations{/tr}</label> 74 </div> 75 </div> 76 </div> 77 </div> 78</form> 79<form action="tiki-edit_languages.php" method="post"> 80 <input type="hidden" name="edit_language" value="{$edit_language}"> 81 <input type="hidden" name="action" value="{$action}"> 82 {if $only_db_translations eq 'y'} 83 <input type="hidden" name="only_db_translations" value="{$only_db_translations}"> 84 {/if} 85 {if $only_db_untranslated eq 'y'} 86 <input type="hidden" name="only_db_untranslated" value="{$only_db_untranslated}"> 87 {/if} 88 {if $action eq 'add_tran_sw'} 89 <div class="card"> 90 <div class="card-header"> 91 {tr}Add a translation{/tr} 92 </div> 93 <div class="card-body"> 94 <div class="form-group row"> 95 <label class="col-md-4 col-form-label">{tr}Original:{/tr}</label> 96 <div class="col-md-8"> 97 <input name="add_tran_source" maxlength="255" class="form-control"> 98 </div> 99 </div> 100 <div class="form-group row"> 101 <label class="col-md-4 col-form-label">{tr}Translation:{/tr}</label> 102 <div class="col-md-8"> 103 <input name="add_tran_tran" maxlength="255" class="form-control"> 104 </div> 105 </div> 106 </div> 107 <div class="card-footer text-center"> 108 <input type="submit" class="btn btn-primary" name="add_tran" value="{tr}Add{/tr}"> 109 </div> 110 </div> 111 {/if} 112 {if $action eq 'edit_tran_sw' || $action eq 'edit_rec_sw'} 113 <div class="card"> 114 <div class="card-header"> 115 {if $action eq 'edit_tran_sw'} 116 {tr}Edit translations{/tr} 117 {else} 118 {tr}Untranslated strings{/tr} 119 {/if} 120 </div> 121 122 <div class="card-body" id="edit_translations"> 123 <div class="d-none d-md-block"> 124 <div class="row"> 125 <h4 class="col-md-6">{tr}Original string{/tr}</h4> 126 <h4 class="col-md-6">{tr}Translation{/tr}</h4> 127 </div> 128 </div> 129 {foreach from=$translations name=translations item=item} 130 <div class="row mb-3"> 131 {* Source string *} 132 <div class="col-md-6"> 133 <label for="source_{$smarty.foreach.translations.index}" class="d-md-none mt-2">{tr}Original string{/tr}</label> 134 <textarea id="source_{$smarty.foreach.translations.index}" 135 name="source_{$smarty.foreach.translations.index}" 136 class="form-control" rows="2" readonly="readonly">{$item.source|escape}</textarea> 137 </div> 138 139 {* Translation *} 140 <div class="col-md-6"> 141 <label for="tran_{$smarty.foreach.translations.index}" class="d-md-none mt-2">{tr}Translation{/tr}</label> 142 <textarea id="tran_{$smarty.foreach.translations.index}" 143 name="tran_{$smarty.foreach.translations.index}" 144 tabindex="{counter start=1}" 145 class="form-control autoheight" rows="2">{$item.tran|escape}</textarea> 146 </div> 147 148 <div class="col-md-12"> 149 {if isset($item.originalTranslation)} 150 <table class="table table-bordered mt-1" id="diff_{$smarty.foreach.translations.index}" style="display:none"> 151 <tbody> 152 {$item.diff} 153 </tbody> 154 </table> 155 {/if} 156 157 <div class="mt-1 text-right"> 158 {if isset($item.user) && isset($item.lastModif)} 159 <div class="form-text"> 160 <small>{tr _0=$item.user|userlink _1=$item.lastModif|tiki_short_date}Last changed by %0 on %1{/tr}</small> 161 </div> 162 {/if} 163 164 <div class="form-inline float-right"> 165 {if $prefs.lang_control_contribution eq 'y'} 166 <div class="form-group mx-md-1" {if ! isset($item.id)}style="display: none"{/if}{* Only translations in the database have an id. *}> 167 <label class="my-1 mr-sm-2" for="scope_{$smarty.foreach.translations.index}" >{tr}Contribute:{/tr}</label> 168 <select class="custom-select my-1 mr-sm-2" name="scope_{$smarty.foreach.translations.index}" id="scope_{$smarty.foreach.translations.index}"> 169 <option {if ! isset($item.general)}selected {/if}value="">{tr}Undecided{/tr}</option> 170 <option {if $item.general === true}selected {/if}value="general">{tr}Yes{/tr}</option> 171 <option {if $item.general === false}selected {/if}value="local">{tr}No{/tr}</option> 172 </select>] 173 </div> 174 {/if} 175 176 <div class="form-group mx-sm-1"> 177 <button type="submit" class="btn btn-primary tips" name="edit_tran_{$smarty.foreach.translations.index}" title=":{tr}Save translation in the database{/tr}"> 178 {tr}Translate{/tr} 179 </button> 180 </div> 181 182 {if $action eq 'edit_tran_sw' && isset($item.changed)} 183 <div class="form-group mx-sm-1"> 184 <button type="submit" class="btn btn-danger tips" name="del_tran_{$smarty.foreach.translations.index}" title=":{tr}Delete translation from the database{/tr}"> 185 {tr}Delete{/tr} 186 </button> 187 </div> 188 {/if} 189 190 {assign var=itemIndex value=$smarty.foreach.translations.index} 191 {if isset($item.originalTranslation)} 192 <div class="form-group mx-sm-1"> 193 {button _flip_id="diff_$itemIndex" _flip_hide_text="n" _text="{tr}Compare{/tr}" _title=":{tr}Compare the original translation with the database translation{/tr}" _class="btn btn-primary btn-sm tips"} 194 </div> 195 {/if} 196 </div> 197 </div> 198 </div> 199 </div> 200 <hr /> 201 {foreachelse} 202 {norecords _colspan=3} 203 {/foreach} 204 205 {jq} 206 jQuery('select[name^="scope_"]').tooltip( 207 {title: "{tr}For translations specific to this Tiki instance, select No. If this translation can be contributed to the Tiki community, select Yes.{/tr}"} 208 ); 209 210 // Allow setting scope of database translations 211 jQuery('textarea[name^="tran_"]').change(function() { 212 jQuery(this).closest('tr').find("label[for^='scope_']").show(); 213 }); 214 {/jq} 215 216 <div class="text-center"> 217 <input type="hidden" name="offset" value="{$offset|escape}"> 218 {if !empty($translations)} 219 <input tabindex="{counter}" type="submit" class="btn btn-primary" name="translate_all" value="{tr}Translate all{/tr}"> 220 {if $action eq 'edit_rec_sw' && $hasDbTranslations == true && $only_db_untranslated eq 'y'} 221 <input type="submit" class="btn btn-danger btn-sm" name="tran_reset" value="{tr}Delete all{/tr}" onclick="return confirm('{tr}Are you sure you want to delete all untranslated strings from database?{/tr}')"> 222 {/if} 223 {if $action eq 'edit_tran_sw' && $only_db_translations eq 'y' && $tiki_p_admin eq 'y'} 224 <input type="submit" class="btn btn-danger btn-sm" name="delete_all" value="{tr}Delete all{/tr}" onclick="return confirm('{tr}Are you sure you want to delete all translations from database?{/tr}')"> 225 {/if} 226 {/if} 227 </div> 228 </div> 229 230 <div class="card-footer text-center"> 231 {pagination_links cant=$total step=$maxRecords offset=$offset _ajax='n'}{strip} 232 tiki-edit_languages.php?edit_language={$edit_language}&action={$action}&maxRecords={$maxRecords}&only_db_translations={$only_db_translations}&only_db_untranslated={$only_db_untranslated}{if isset($find)}&find={$find}{/if} 233 {/strip}{/pagination_links} 234 </div> 235 </div> 236 {/if} 237</form> 238