summaryrefslogtreecommitdiffstats
path: root/lang/dictionary.php
diff options
context:
space:
mode:
Diffstat (limited to 'lang/dictionary.php')
-rw-r--r--lang/dictionary.php25
1 files changed, 16 insertions, 9 deletions
diff --git a/lang/dictionary.php b/lang/dictionary.php
index 25f28a76..e1281dd1 100644
--- a/lang/dictionary.php
+++ b/lang/dictionary.php
@@ -2,27 +2,34 @@
class Dictionary{
private static $dictionary;
- private static $langArray;
private static $messageArray;
function build(){
- self::$dictionary = json_decode(file_get_contents("lang/dictionary.json"),true);
- foreach(self::$dictionary as $key => $text){
- self::$langArray[$key] = $text[LANG];
- }
- self::$messageArray = json_decode(file_get_contents("lang/".LANG."/messages.json"),true);
+ self::$dictionary = self::sliceArray(json_decode(file_get_contents("lang/dictionary.json"),true));
+ self::$messageArray = self::sliceArray(json_decode(file_get_contents("lang/translations/messages.json"),true));
}
-
+
public static function getArray(){
- return self::$langArray;
+ return self::$dictionary;
+ }
+
+ public static function getArrayTemplate($template){
+ return self::sliceArray(json_decode(file_get_contents("lang/translations/" . $template . ".json"),true));
}
public static function translate($string){
- return self::$langArray[$string];
+ return self::$dictionary[$string];
}
public static function getMessages(){
return self::$messageArray;
}
+
+ private static function sliceArray($array){
+ foreach($array as $key => $text){
+ $array[$key] = $text[LANG];
+ }
+ return $array;
+ }
}