Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/env/PhabricatorEnv.php
| Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | private static function initializeCommonEnvironment() { | ||||
| PhabricatorEventEngine::initialize(); | PhabricatorEventEngine::initialize(); | ||||
| // TODO: Add a "locale.default" config option once we have some reasonable | // TODO: Add a "locale.default" config option once we have some reasonable | ||||
| // defaults which aren't silly nonsense. | // defaults which aren't silly nonsense. | ||||
| self::setLocaleCode('en_US'); | self::setLocaleCode('en_US'); | ||||
| } | } | ||||
| public static function beginScopedLocale($locale_code) { | |||||
| return new PhabricatorLocaleScopeGuard($locale_code); | |||||
| } | |||||
| public static function getLocaleCode() { | |||||
| return self::$localeCode; | |||||
| } | |||||
| public static function setLocaleCode($locale_code) { | public static function setLocaleCode($locale_code) { | ||||
| if (!$locale_code) { | |||||
| return; | |||||
| } | |||||
| if ($locale_code == self::$localeCode) { | if ($locale_code == self::$localeCode) { | ||||
| return; | return; | ||||
| } | } | ||||
| try { | try { | ||||
| $locale = PhutilLocale::loadLocale($locale_code); | $locale = PhutilLocale::loadLocale($locale_code); | ||||
| $translations = PhutilTranslation::getTranslationMapForLocale( | $translations = PhutilTranslation::getTranslationMapForLocale( | ||||
| $locale_code); | $locale_code); | ||||
| ▲ Show 20 Lines • Show All 742 Lines • Show Last 20 Lines | |||||