From dbc0d9614421e064cc62aacf116ebb783c83f2f3 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Fri, 1 Apr 2016 16:50:13 +0200 Subject: [merge] merging c3sl / fr - initial commit --- inc/dictionary.inc.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'inc/dictionary.inc.php') 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]; } -- cgit v1.2.3-55-g7522