diff options
| author | 2015-01-08 16:32:13 +0100 | |
|---|---|---|
| committer | 2015-01-08 16:32:13 +0100 | |
| commit | 19dfef8b49f78e898ea5841869ff80cc351724bc (patch) | |
| tree | 4723dda20a5429033d708beb51a5636e6bc873b4 | |
| parent | 85ea5e548ac1057feeb8dfff99b1b433e4ecfd6b (diff) | |
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.
| -rw-r--r-- | app/views/user/manage.phtml | 4 | ||||
| -rw-r--r-- | lib/Minz/Translate.php | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index 11c42a857..466446f2f 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -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> diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php index 24497a193..d8ce2a0f7 100644 --- a/lib/Minz/Translate.php +++ b/lib/Minz/Translate.php @@ -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; |
