mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
L10n: Add the ability to specify a fallback locale for locales
This commit is contained in:
parent
6fca87bc3f
commit
f249437af2
2 changed files with 2 additions and 1 deletions
|
@ -57,7 +57,7 @@ class Localizator
|
||||||
$lang = is_null($lang) ? static::DEFAULT_LANG : $lang;
|
$lang = is_null($lang) ? static::DEFAULT_LANG : $lang;
|
||||||
$array = @self::parse(dirname(__FILE__) . "/../../locales/$lang.strings");
|
$array = @self::parse(dirname(__FILE__) . "/../../locales/$lang.strings");
|
||||||
|
|
||||||
return $array[$id] ?? "@$id";
|
return $array[$id] ?? (!empty($array["__fallback"]) ? $this->_($id, $array["__fallback"]) : "@$id");
|
||||||
}
|
}
|
||||||
|
|
||||||
function export($lang = NULL): ?array
|
function export($lang = NULL): ?array
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"__locale" = "ru_UA.utf8;ru_RU.UTF-8;Rus";
|
"__locale" = "ru_UA.utf8;ru_RU.UTF-8;Rus";
|
||||||
"__WinEncoding" = "Windows-1251";
|
"__WinEncoding" = "Windows-1251";
|
||||||
|
"__fallback" = "ru";
|
||||||
|
|
||||||
/* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */
|
/* Check for https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue