diff options
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; } + } |