mirror of
https://github.com/prasathmani/tinyfilemanager
synced 2024-06-09 01:12:16 +02:00
Use a separate method to retrieve translatable strings
This commit is contained in:
parent
b5d592425d
commit
df12fe3005
|
@ -4106,7 +4106,26 @@ function lng($txt) {
|
|||
|
||||
// English language
|
||||
$tr = [
|
||||
'en' => [
|
||||
'en' => getTranslatableStrings(),
|
||||
];
|
||||
|
||||
$i18n = fm_get_translations($tr);
|
||||
$tr = $i18n ? $i18n : $tr;
|
||||
|
||||
if (!strlen($lang)) $lang = 'en';
|
||||
if (isset($tr[$lang][$txt])) return fm_enc($tr[$lang][$txt]);
|
||||
else if (isset($tr['en'][$txt])) return fm_enc($tr['en'][$txt]);
|
||||
else return "$txt";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the translatable strings.
|
||||
*
|
||||
* @return array array keys are the subject of the lng() function, values are the English strings.
|
||||
*/
|
||||
function getTranslatableStrings()
|
||||
{
|
||||
static $strings = [
|
||||
'Access denied. IP restriction applicable' => 'Access denied. IP restriction applicable',
|
||||
'Actions' => 'Actions',
|
||||
'Advanced Search' => 'Advanced Search',
|
||||
|
@ -4234,16 +4253,7 @@ function lng($txt) {
|
|||
'You are logged in' => 'You are logged in',
|
||||
'Zero byte file! Aborting download' => 'Zero byte file! Aborting download',
|
||||
'Zip' => 'Zip',
|
||||
],
|
||||
];
|
||||
|
||||
$i18n = fm_get_translations($tr);
|
||||
$tr = $i18n ? $i18n : $tr;
|
||||
|
||||
if (!strlen($lang)) $lang = 'en';
|
||||
if (isset($tr[$lang][$txt])) return fm_enc($tr[$lang][$txt]);
|
||||
else if (isset($tr['en'][$txt])) return fm_enc($tr['en'][$txt]);
|
||||
else return "$txt";
|
||||
return $strings;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue