diff --git a/tinyfilemanager.php b/tinyfilemanager.php index 81da5483..16a92cf3 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -1,7 +1,6 @@ data['lang']) ? $cfg->data['lang'] : 'en'; +// Show or hide translation control +$show_translation = isset($cfg->data['show_translation']) ? $cfg->data['show_translation'] : true; + // Show or hide files and folders that starts with a dot $show_hidden_files = isset($cfg->data['show_hidden']) ? $cfg->data['show_hidden'] : true; @@ -537,13 +539,14 @@ function getClientIP() // Save Config if (isset($_POST['type']) && $_POST['type'] == "settings") { - global $cfg, $lang, $report_errors, $show_hidden_files, $lang_list, $hide_Cols, $theme; + global $cfg, $lang, $show_translation, $report_errors, $show_hidden_files, $lang_list, $hide_Cols, $theme; $newLng = $_POST['js-language']; fm_get_translations([]); if (!array_key_exists($newLng, $lang_list)) { $newLng = 'en'; } - + + $trl = isset($_POST['js-show-translation']) && $_POST['js-show-translation'] == "true" ? true : false; $erp = isset($_POST['js-error-report']) && $_POST['js-error-report'] == "true" ? true : false; $shf = isset($_POST['js-show-hidden']) && $_POST['js-show-hidden'] == "true" ? true : false; $hco = isset($_POST['js-hide-cols']) && $_POST['js-hide-cols'] == "true" ? true : false; @@ -553,15 +556,15 @@ function getClientIP() $cfg->data['lang'] = $newLng; $lang = $newLng; } + if ($cfg->data['show_translation'] != $trl) { + $cfg->data['show_translation'] = $trl; + $show_translation = $trl; + } if ($cfg->data['error_reporting'] != $erp) { $cfg->data['error_reporting'] = $erp; $report_errors = $erp; } - if ($cfg->data['show_hidden'] != $shf) { - $cfg->data['show_hidden'] = $shf; - $show_hidden_files = $shf; - } - if ($cfg->data['show_hidden'] != $shf) { + if ($cfg->data['show_hidden'] != $shf) { $cfg->data['show_hidden'] = $shf; $show_hidden_files = $shf; } @@ -1599,7 +1602,17 @@ function getSelected($l) -
'; + echo '"name": "'.$lang_list[$lang].'",
'; + echo '"code": "'.$lang.'",
'; + echo '"vers": "'.APP_TITLE.' '.VERSION.'",
'; + echo '"note": "vers, note, date, author are new fields 2026",
'; + echo '"date": "'.date("Y-m-d").'",
'; + echo '"author": "----",
'; + echo '"translation": {
'; + $array1= extractTxt(file_get_contents(__FILE__),'lng'); + $array2= extractTxt(file_get_contents(__FILE__),'toast'); + $array = array_merge(array_values($array1), array_values($array2)); + $last = count($array) - 1; $n=0; + foreach ($array as $ix => $key) { + if ($key == lng($key)) $n++; + echo ' "'.$key.'": "'.($key==lng($key) ? ''. $n.': ' : '').lng($key).''.'"'; + echo ($ix < $last) ? ",
" : "
"; + } + echo '}
Suggestions for updating the english tr table:
'; + $s= []; + foreach ($array as $a) { # in function lng($txt) add $tr as global: "global $lang, $tr;" + $str = ' $tr[\'en\'][\''.$a.'\'] '; + echo $str.indentAfter($str,70).'= \''.($tr['en'][($a)] > '' ? $tr['en'][($a)] : $a).'\';
'; + $newArr[$a] = $a; + } + echo ' Total: '.count($array) . ' keys in list.'; + $ar= array_merge($newArr, array_diff($tr['en'])); + } +} + ?>