mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-04-16 12:27:20 -04:00
Fix bug with Minz_Translate
When a path was registered before initialization, it was not considered unless by calling reset() method. This is fixed now.
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
<div class="group-controls">
|
||||
<select name="new_user_language" id="new_user_language">
|
||||
<?php $languages = Minz_Translate::availableLanguages(); ?>
|
||||
<?php foreach ($languages as $short => $lib) { ?>
|
||||
<option value="<?php echo $short; ?>"<?php echo FreshRSS_Context::$user_conf->language === $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
|
||||
<?php foreach ($languages as $lang) { ?>
|
||||
<option value="<?php echo $lang; ?>"<?php echo FreshRSS_Context::$user_conf->language === $lang ? ' selected="selected"' : ''; ?>><?php echo _t('gen.lang.' . $lang); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -35,10 +35,12 @@ class Minz_Translate {
|
||||
*/
|
||||
public static function init($lang_name = null) {
|
||||
self::$lang_name = $lang_name;
|
||||
self::$path_list = array();
|
||||
self::$lang_files = array();
|
||||
self::$translates = array();
|
||||
self::registerPath(APP_PATH . '/i18n');
|
||||
foreach (self::$path_list as $path) {
|
||||
self::loadLang($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +76,7 @@ class Minz_Translate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new path and load i18n files inside.
|
||||
* Register a new path.
|
||||
* @param $path a path containing i18n directories (e.g. ./en/, ./fr/).
|
||||
*/
|
||||
public static function registerPath($path) {
|
||||
@@ -83,7 +85,6 @@ class Minz_Translate {
|
||||
}
|
||||
|
||||
self::$path_list[] = $path;
|
||||
self::loadLang($path);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,7 +165,8 @@ class Minz_Translate {
|
||||
|
||||
// If $translates[$top_level] is null it means we have to load the
|
||||
// corresponding files.
|
||||
if (is_null(self::$translates[$top_level])) {
|
||||
if (!isset(self::$translates[$top_level]) ||
|
||||
is_null(self::$translates[$top_level])) {
|
||||
$res = self::loadKey($top_level);
|
||||
if (!$res) {
|
||||
return $key;
|
||||
|
||||
Reference in New Issue
Block a user