summaryrefslogtreecommitdiffstats
path: root/lang/dictionary.php
diff options
context:
space:
mode:
authorraul2014-07-07 15:50:47 +0200
committerraul2014-07-07 15:50:47 +0200
commit0793e760df82502748ea47062dfd601684e7e163 (patch)
tree68548fac6d8805978eedf65c5236fac5ce461820 /lang/dictionary.php
parent[i18n]finished translation with sql, queries and translated hardcoded message (diff)
downloadslx-admin-0793e760df82502748ea47062dfd601684e7e163.tar.gz
slx-admin-0793e760df82502748ea47062dfd601684e7e163.tar.xz
slx-admin-0793e760df82502748ea47062dfd601684e7e163.zip
[i18n]separated jsons by template, and finished other php details
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;
+ }
}