diff options
author | raul | 2014-06-24 16:58:54 +0200 |
---|---|---|
committer | Michael Pereira Neves | 2014-07-11 15:01:59 +0200 |
commit | 2ee30c8128a464386f87be428f3ab3061d073e40 (patch) | |
tree | 85af1f5d429668d99dae06fb9cdd3b081829ad84 /dictionary.php | |
parent | [i18n] add i18n support, WIP (diff) | |
download | slx-admin-2ee30c8128a464386f87be428f3ab3061d073e40.tar.gz slx-admin-2ee30c8128a464386f87be428f3ab3061d073e40.tar.xz slx-admin-2ee30c8128a464386f87be428f3ab3061d073e40.zip |
[i18n] implemented translator logic
Diffstat (limited to 'dictionary.php')
-rw-r--r-- | dictionary.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/dictionary.php b/dictionary.php index 9563f7c3..00834a49 100644 --- a/dictionary.php +++ b/dictionary.php @@ -1,14 +1,18 @@ <?php class Dictionary{ - private $dictionary; + private static $dictionary; + private static $langArray; - function __construct(){ - $this->dictionary = json_decode(file_get_contents("dictionary.json"),true); + function build(){ + self::$dictionary = json_decode(file_get_contents("dictionary.json"),true); + foreach(self::$dictionary as $key => $text){ + self::$langArray[$key] = $text[LANG]; + } } - - public function translate($text){ - return $this->dictionary[$text][LANG]; + public static function getArray(){ + return self::$langArray; } + } |