@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | * @param bool $force_reload |
24 | 24 | */ |
25 | 25 | protected static function checkLoad($custom_key = null, $force_reload = false) { |
26 | - if($force_reload) self::dropInstance(); |
|
26 | + if ($force_reload) self::dropInstance(); |
|
27 | 27 | self::$locale = I18nHelper::extractLocale('es_ES'); |
28 | 28 | $custom_key = $custom_key ?: Security::getInstance()->getSessionKey(self::CUSTOM_LOCALE_SESSION_KEY); |
29 | - if(null !== $custom_key) { |
|
30 | - Logger::log('[' . self::class . '] Custom key detected: ' . $custom_key, LOG_INFO); |
|
31 | - $filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', $custom_key, self::$locale . '.json']); |
|
32 | - if(file_exists($filename)) { |
|
33 | - Logger::log('[' . self::class . '] Custom locale detected: ' . $custom_key . ' [' . self::$locale . ']', LOG_INFO); |
|
29 | + if (null !== $custom_key) { |
|
30 | + Logger::log('['.self::class.'] Custom key detected: '.$custom_key, LOG_INFO); |
|
31 | + $filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', $custom_key, self::$locale.'.json']); |
|
32 | + if (file_exists($filename)) { |
|
33 | + Logger::log('['.self::class.'] Custom locale detected: '.$custom_key.' ['.self::$locale.']', LOG_INFO); |
|
34 | 34 | self::$translations = json_decode(file_get_contents($filename), true); |
35 | 35 | } |
36 | 36 | } |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public static function _($message, $custom_key = null, $force_reload = false) { |
74 | 74 | self::checkLoad($custom_key, $force_reload); |
75 | - if(array_key_exists($message, self::$translations)) { |
|
75 | + if (array_key_exists($message, self::$translations)) { |
|
76 | 76 | return self::$translations[$message]; |
77 | - } else { |
|
77 | + }else { |
|
78 | 78 | return gettext($message); |
79 | 79 | } |
80 | 80 | } |
@@ -23,7 +23,9 @@ |
||
23 | 23 | * @param bool $force_reload |
24 | 24 | */ |
25 | 25 | protected static function checkLoad($custom_key = null, $force_reload = false) { |
26 | - if($force_reload) self::dropInstance(); |
|
26 | + if($force_reload) { |
|
27 | + self::dropInstance(); |
|
28 | + } |
|
27 | 29 | self::$locale = I18nHelper::extractLocale('es_ES'); |
28 | 30 | $custom_key = $custom_key ?: Security::getInstance()->getSessionKey(self::CUSTOM_LOCALE_SESSION_KEY); |
29 | 31 | if(null !== $custom_key) { |