src/RocknRoot/StrayFw/Locale/Locale.php
public static function init(RawRequest $request = null)
    {
        if (self::$isInit === false) {
            self::$translations = array();
            $settings = Config::getSettings();
            if (isset($settings['locale']) === false || isset($settings['locale']['default']) === false) {
                throw new BadUse('locale.default isn\'t defined in settings');
            }
            self::$currentLanguage = $settings['locale']['default'];
            if ($request != null) {
                if (Session::has('_stray_language') === true) {
                    self::$currentLanguage = Session::get('_stray_language');
                } else {
                    $domain = HttpHelper::extractDomain($request);
                    if (isset($settings['locale']['hosts']) === true && isset($settings['locale']['hosts'][$domain]) === true) {
                        self::$currentLanguage = $settings['locale']['hosts'][$domain];
                    }
                    Session::set('_stray_language', self::$currentLanguage);
                }
            }
            self::$isInit = true;
        }
    }
public static function init(RawRequest $request = null)
    {
        if (self::$isInit === false) {
            self::$translations = array();
            $settings = Config::getSettings();
            if (isset($settings['locale']) === false || isset($settings['locale']['default']) === false) {
                throw new BadUse('locale.default isn\'t defined in settings');
            }
            self::$currentLanguage = $settings['locale']['default'];
            if ($request != null) {
                if (Session::has('_stray_language') === true) {
                    self::$currentLanguage = Session::get('_stray_language');
                } else {
                    $domain = HttpHelper::extractDomain($request);
                    if (isset($settings['locale']['hosts']) === true && isset($settings['locale']['hosts'][$domain]) === true) {
                        self::$currentLanguage = $settings['locale']['hosts'][$domain];
                    }
                    Session::set('_stray_language', self::$currentLanguage);
                }
            }
            self::$isInit = true;
        }
    }
Initialize properties, detect current language and load translations.

@static
@throws BadUse     if locale.default isn\'t defined in settings
@param  RawRequest $request base raw request if applied