@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | { |
20 | 20 | $this->locale = I18nHelper::extractLocale('es_ES'); |
21 | 21 | $custom_key = Security::getInstance()->getSessionKey(self::CUSTOM_LOCALE_SESSION_KEY); |
22 | - if(null !== $custom_key) { |
|
23 | - Logger::log('[' . self::class . '] Custom key detected: ' . $custom_key, LOG_INFO); |
|
24 | - $filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', $custom_key, $this->locale . '.json']); |
|
25 | - if(file_exists($filename)) { |
|
26 | - Logger::log('[' . self::class . '] Custom locale detected: ' . $custom_key . ' [' . $this->locale . ']', LOG_INFO); |
|
22 | + if (null !== $custom_key) { |
|
23 | + Logger::log('['.self::class.'] Custom key detected: '.$custom_key, LOG_INFO); |
|
24 | + $filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', $custom_key, $this->locale.'.json']); |
|
25 | + if (file_exists($filename)) { |
|
26 | + Logger::log('['.self::class.'] Custom locale detected: '.$custom_key.' ['.$this->locale.']', LOG_INFO); |
|
27 | 27 | $this->translations = json_decode(file_get_contents($filename), true); |
28 | 28 | } |
29 | 29 | } |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | { |
45 | 45 | return array( |
46 | 46 | new \Twig_SimpleFilter('trans', function($message) { |
47 | - if(array_key_exists($message, $this->translations)) { |
|
47 | + if (array_key_exists($message, $this->translations)) { |
|
48 | 48 | return $this->translations[$message]; |
49 | - } else { |
|
49 | + }else { |
|
50 | 50 | return gettext($message); |
51 | 51 | } |
52 | 52 | }), |