diff options
| author | 2015-01-08 10:27:01 +0100 | |
|---|---|---|
| committer | 2015-01-08 10:27:01 +0100 | |
| commit | 46e98bad9119c3ee7088b65ebb6b4d1331419602 (patch) | |
| tree | 6f0e081597ba9ced0c0faca9b5e4c04394605aaf /lib/Minz/Translate.php | |
| parent | 7584364a4c2b407e97909e94ba274da62620abea (diff) | |
| parent | 9265cd57333b2a91effc6ea284b504fbc977b9ed (diff) | |
Merge branch '730-improve_configuration' into dev
BREAKING FEATURE: please follow instructions from
https://github.com/FreshRSS/FreshRSS/issues/730 to
update your configuration file.
Fix https://github.com/FreshRSS/FreshRSS/issues/730
Diffstat (limited to 'lib/Minz/Translate.php')
| -rw-r--r-- | lib/Minz/Translate.php | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php index e7efb8665..1b4102ca9 100644 --- a/lib/Minz/Translate.php +++ b/lib/Minz/Translate.php @@ -10,6 +10,11 @@ */ class Minz_Translate { /** + * $lang_list is the list of available languages. + */ + private static $lang_list = array(); + + /** * $lang_name is the name of the current language to use. */ private static $lang_name; @@ -25,19 +30,30 @@ class Minz_Translate { private static $translates = array(); /** - * Load $lang_name and $lang_path based on configuration and selected language. + * Init the translation object. + * @param $lang_list the list of available languages. + * @param $lang_name the lang to show. */ - public static function init() { - $l = Minz_Configuration::language(); - self::$lang_name = Minz_Session::param('language', $l); + public static function init($lang_list, $lang_name) { + self::$lang_list = $lang_list; + self::$lang_name = $lang_name; self::$lang_path = APP_PATH . '/i18n/' . self::$lang_name . '/'; } /** - * Alias for init(). + * Reset the translation object with a new language. + * @param $lang_name the new language to use + */ + public static function reset($lang_name) { + self::init(self::$lang_list, $lang_name); + } + + /** + * Return the list of available languages. + * @return an array. */ - public static function reset() { - self::init(); + public static function availableLanguages() { + return self::$lang_list; } /** |
