diff options
| author | raul | 2014-06-24 16:58:54 +0200 |
|---|---|---|
| committer | raul | 2014-06-24 16:58:54 +0200 |
| commit | 3f00f46bcdd7d4d93deecd62ec59405168123887 (patch) | |
| tree | 66cd7b5952e2ecf9c94999ee1cbb0a0d1362aeca /dictionary.php | |
| parent | [i18n] add i18n support, WIP (diff) | |
| download | slx-admin-3f00f46bcdd7d4d93deecd62ec59405168123887.tar.gz slx-admin-3f00f46bcdd7d4d93deecd62ec59405168123887.tar.xz slx-admin-3f00f46bcdd7d4d93deecd62ec59405168123887.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; } + } |
