diff options
author | Jonathan Bauer | 2016-04-01 16:50:13 +0200 |
---|---|---|
committer | Jonathan Bauer | 2016-04-01 16:50:13 +0200 |
commit | dbc0d9614421e064cc62aacf116ebb783c83f2f3 (patch) | |
tree | 091844b8578ff1d9ac18edfd3cee3e63210133d7 /inc/dictionary.inc.php | |
parent | [ldapauth] Add homedir conf to ldap wizard (diff) | |
download | slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.gz slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.tar.xz slx-admin-dbc0d9614421e064cc62aacf116ebb783c83f2f3.zip |
[merge] merging c3sl / fr - initial commit
Diffstat (limited to 'inc/dictionary.inc.php')
-rw-r--r-- | inc/dictionary.inc.php | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/inc/dictionary.inc.php b/inc/dictionary.inc.php index fc509112..ec4f4195 100644 --- a/inc/dictionary.inc.php +++ b/inc/dictionary.inc.php @@ -51,21 +51,26 @@ class Dictionary define('LANG', $language); } - public static function getArrayTemplate($template, $lang = false) + public static function getArrayTemplate($template, $module = false, $lang = false) { - return self::getArray('templates/' . $template, $lang); + return self::getArray($module . "/" . $template, $lang); } - public static function getArray($section, $lang = false) + public static function getArray($module, $lang = false, $isMessage = false) { if ($lang === false) $lang = LANG; - $file = Util::safePath("lang/" . $lang . "/" . $section . ".json"); + if(!$isMessage) + $file = Util::safePath("lang/" . $lang . "/modules/" . $module . ".json"); + else + $file = Util::safePath("lang/" . $lang . "/" . $module . ".json"); + if (isset(self::$stringCache[$file])) return self::$stringCache[$file]; $content = @file_get_contents($file); - if ($content === false) // File does not exist for language + if ($content === false) {// File does not exist for language { return array(); + } $json = json_decode($content, true); if (!is_array($json)) return array(); @@ -83,9 +88,10 @@ class Dictionary return "(missing: $string :missing)"; return self::$hardcodedMessages[$string]; } - $strings = self::getArray($section); - if (!isset($strings[$string])) + $strings = self::getArray($section, false, true); + if (!isset($strings[$string])) { return "(missing: '$string' in '$section')"; + } return $strings[$string]; } |