mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-14 18:23:52 -04:00
Fixed: i18n extensions: 'en' as fallback (#5426)
* Update Translate.php * Small improvements --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
This commit is contained in:
@@ -37,7 +37,7 @@ class Minz_Translate {
|
||||
* Init the translation object.
|
||||
* @param string $lang_name the lang to show.
|
||||
*/
|
||||
public static function init(?string $lang_name = null): void {
|
||||
public static function init(string $lang_name = ''): void {
|
||||
self::$lang_name = $lang_name;
|
||||
self::$lang_files = array();
|
||||
self::$translates = array();
|
||||
@@ -125,9 +125,14 @@ class Minz_Translate {
|
||||
*/
|
||||
private static function loadLang(string $path): void {
|
||||
$lang_path = $path . '/' . self::$lang_name;
|
||||
if (!file_exists($lang_path) || self::$lang_name == '') {
|
||||
// The lang path does not exist, nothing more to do.
|
||||
return;
|
||||
if (self::$lang_name === '' || !is_dir($lang_path)) {
|
||||
// The lang path does not exist, fallback to English ('en')
|
||||
self::$lang_name = 'en';
|
||||
$lang_path = $path . '/' . self::$lang_name;
|
||||
if (!is_dir($lang_path)) {
|
||||
// English ('en') i18n files not provided. Stop here. The keys will be shown.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$list_i18n_files = array_values(array_diff(
|
||||
|
||||
Reference in New Issue
Block a user