@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @param string $default |
| 21 | - * @return array|mixed|string |
|
| 21 | + * @return string |
|
| 22 | 22 | */ |
| 23 | 23 | private static function extractLocale($default = null) |
| 24 | 24 | { |
@@ -29,21 +29,21 @@ discard block |
||
| 29 | 29 | list($BrowserLocales[$i]) = explode(";", $BrowserLocales[$i]); //trick for "en;q=0.8" |
| 30 | 30 | } |
| 31 | 31 | $locale = array_shift($BrowserLocales); |
| 32 | - } else { |
|
| 32 | + }else { |
|
| 33 | 33 | $locale = strtolower($locale); |
| 34 | 34 | } |
| 35 | 35 | if (false !== strpos($locale, '_')) { |
| 36 | 36 | $locale = explode('_', $locale); |
| 37 | 37 | if ($locale[0] == 'en') { |
| 38 | - $locale = $locale[0] . '_GB'; |
|
| 39 | - } else { |
|
| 40 | - $locale = $locale[0] . '_' . strtoupper($locale[1]); |
|
| 38 | + $locale = $locale[0].'_GB'; |
|
| 39 | + }else { |
|
| 40 | + $locale = $locale[0].'_'.strtoupper($locale[1]); |
|
| 41 | 41 | } |
| 42 | - } else { |
|
| 42 | + }else { |
|
| 43 | 43 | if (strtolower($locale) === 'en') { |
| 44 | 44 | $locale = 'en_GB'; |
| 45 | - } else { |
|
| 46 | - $locale = $locale . '_' . strtoupper($locale); |
|
| 45 | + }else { |
|
| 46 | + $locale = $locale.'_'.strtoupper($locale); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | if (!in_array($locale, self::$langs)) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $translations = array(); |
| 65 | 65 | if (file_exists($absoluteTranslationFileName)) { |
| 66 | 66 | @include($absoluteTranslationFileName); |
| 67 | - } else { |
|
| 67 | + }else { |
|
| 68 | 68 | Cache::getInstance()->storeData($absoluteTranslationFileName, "<?php \$translations = array();\n", Cache::TEXT, TRUE); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | public static function setLocale() |
| 78 | 78 | { |
| 79 | 79 | $locale = self::extractLocale('es_ES'); |
| 80 | - Logger::log('Set locale to project [' . $locale . ']'); |
|
| 80 | + Logger::log('Set locale to project ['.$locale.']'); |
|
| 81 | 81 | // Load translations |
| 82 | - putenv("LC_ALL=" . $locale); |
|
| 82 | + putenv("LC_ALL=".$locale); |
|
| 83 | 83 | setlocale(LC_ALL, $locale); |
| 84 | 84 | // Load the locale path |
| 85 | - $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale'; |
|
| 86 | - Logger::log('Set locale dir ' . $locale_path); |
|
| 85 | + $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale'; |
|
| 86 | + Logger::log('Set locale dir '.$locale_path); |
|
| 87 | 87 | GeneratorHelper::createDir($locale_path); |
| 88 | 88 | bindtextdomain('translations', $locale_path); |
| 89 | 89 | textdomain('translations'); |