@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $locale = Request::header('X-API-LANG', $default); |
29 | 29 | if (empty($locale)) { |
30 | 30 | $locale = Security::getInstance()->getSessionKey(self::PSFS_SESSION_LANGUAGE_KEY); |
31 | - if(empty($locale) && array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) { |
|
31 | + if (empty($locale) && array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) { |
|
32 | 32 | $BrowserLocales = explode(",", str_replace("-", "_", $_SERVER["HTTP_ACCEPT_LANGUAGE"])); // brosers use en-US, Linux uses en_US |
33 | 33 | for ($i = 0, $ct = count($BrowserLocales); $i < $ct; $i++) { |
34 | 34 | list($BrowserLocales[$i]) = explode(";", $BrowserLocales[$i]); //trick for "en;q=0.8" |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | // TODO check more en locales |
45 | 45 | if (strtolower($locale) === 'en') { |
46 | 46 | $locale = 'en_GB'; |
47 | - } else { |
|
48 | - $locale = $locale . '_' . strtoupper($locale); |
|
47 | + }else { |
|
48 | + $locale = $locale.'_'.strtoupper($locale); |
|
49 | 49 | } |
50 | 50 | $default_locales = explode(',', Config::getParam('i18n.locales', '')); |
51 | 51 | if (!in_array($locale, array_merge($default_locales, self::$langs))) { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $translations = array(); |
67 | 67 | if (file_exists($absoluteTranslationFileName)) { |
68 | 68 | @include($absoluteTranslationFileName); |
69 | - } else { |
|
69 | + }else { |
|
70 | 70 | Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE); |
71 | 71 | } |
72 | 72 | |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | public static function setLocale($default = 'es_ES') |
82 | 82 | { |
83 | 83 | $locale = self::extractLocale($default); |
84 | - Logger::log('Set locale to project [' . $locale . ']'); |
|
84 | + Logger::log('Set locale to project ['.$locale.']'); |
|
85 | 85 | // Load translations |
86 | - putenv("LC_ALL=" . $locale); |
|
86 | + putenv("LC_ALL=".$locale); |
|
87 | 87 | setlocale(LC_ALL, $locale); |
88 | 88 | // Load the locale path |
89 | - $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale'; |
|
90 | - Logger::log('Set locale dir ' . $locale_path); |
|
89 | + $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale'; |
|
90 | + Logger::log('Set locale dir '.$locale_path); |
|
91 | 91 | GeneratorHelper::createDir($locale_path); |
92 | 92 | bindtextdomain('translations', $locale_path); |
93 | 93 | textdomain('translations'); |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public static function checkI18Class($namespace) { |
125 | 125 | $isI18n = false; |
126 | - if(preg_match('/I18n$/i', $namespace)) { |
|
126 | + if (preg_match('/I18n$/i', $namespace)) { |
|
127 | 127 | $parentClass = preg_replace('/I18n$/i', '', $namespace); |
128 | - if(Router::exists($parentClass)) { |
|
128 | + if (Router::exists($parentClass)) { |
|
129 | 129 | $isI18n = true; |
130 | 130 | } |
131 | 131 | } |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | ['i', 'i', 'i', 'i', 'I', 'I', 'I', 'I'], |
152 | 152 | ['o', 'o', 'o', 'o', 'O', 'O', 'O', 'O'], |
153 | 153 | ['u', 'u', 'u', 'u', 'U', 'U', 'U', 'U'], |
154 | - ['n', 'N', 'c', 'C',], |
|
154 | + ['n', 'N', 'c', 'C', ], |
|
155 | 155 | ]; |
156 | 156 | |
157 | 157 | $text = filter_var($string, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); |
158 | - for($i = 0, $total = count($from); $i < $total; $i++) { |
|
159 | - $text = str_replace($from[$i],$to[$i], $text); |
|
158 | + for ($i = 0, $total = count($from); $i < $total; $i++) { |
|
159 | + $text = str_replace($from[$i], $to[$i], $text); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | return $text; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public static function dropInstance() { |
42 | 42 | $class = static::class; |
43 | - if(isset(self::$instance[$class])) { |
|
43 | + if (isset(self::$instance[$class])) { |
|
44 | 44 | self::$instance[$class] = null; |
45 | 45 | } |
46 | 46 | } |