diff options
| author | 2015-01-08 16:32:13 +0100 | |
|---|---|---|
| committer | 2015-01-08 16:32:13 +0100 | |
| commit | 19dfef8b49f78e898ea5841869ff80cc351724bc (patch) | |
| tree | 4723dda20a5429033d708beb51a5636e6bc873b4 /lib/Minz/Translate.php | |
| 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.
Diffstat (limited to 'lib/Minz/Translate.php')
| -rw-r--r-- | lib/Minz/Translate.php | 10 |
1 files changed, 6 insertions, 4 deletions
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; |
