Load langs array
@param array $langs
@param string $lang
975371
public static function load(array $langs, $lang = null)
    {
        static::$langs = $langs;
        static::$lang = $lang ?: key($langs);
    }
763843
private function loadTranslationMessages($language)
    {
        // Reset any previous translations if any
        $this->moduleManager->clearTranslations();
        $this->translator->reset();

        // Now load new ones
        $this->moduleManager->loadAllTranslations($language);
        $this->translator->extend($this->moduleManager->getTranslations());
    }
1066343
protected function load($lang, $path, array $packages)
    {
        // 扫描目录并加载语言包
        foreach ($packages as $package) {
            $file = sprintf('%s/%s.php', $path, str_replace('.', '/', $package));

            // 语言文件不存在
            if (!is_file($file)) {
                continue;
            }

            // 无效语言包
            $return = include $file;
            if (!is_array($return)) {
                continue;
            }

            foreach ($return as $key => $value) {
                $this->imported[$lang][$key] = $value;
            }
        }
    }
1023735
public static function setLanguage($lang)
    {
        static::$_appLanguage = Yii::$app->language;

        Yii::$app->language = $lang;
    }
67676
public function addTranslationArray(array $translations, $language)
    {
        $language = (string) $language;
        if ($language === '') {
            throw new \InvalidArgumentException('$language cannot be empty');
        }

        if (!isset($this->translations[$language])) {
            $this->translations[$language] = [];
        }

        $this->translations[$language] = array_merge(
            $this->translations[$language],
            $translations
        );
    }
53205
public function setLang( $lang ) {
		if ( !IntuitionUtil::nonEmptyStr( $lang ) ) {
			return false;
		}
		$this->currentLanguage = $this->normalizeLang( $lang );
		return true;
	}
623065
final protected function loadTranslations($language)
    {
        // Don't load the same language twice, if that's the case
        if ($this->appConfig->getLanguage() !== $language) {

            $this->appConfig->setLanguage($language);
            $this->loadTranslationMessages($language);
            return true;

        } else {
            return false;
        }
    }
777649
public function setLanguage(string $lang): void
    {
        if (!is_string($lang) || empty($lang)) {
            throw new \InvalidArgumentException("Invalid language $lang");
        }
        
        $this->lang = $lang;
    }
812718
public function setLanguage(array $language): void
	{
		$this->language = $language['strings'];

		foreach($language['locale'] as $category => $locale)
		{
			setlocale($category, $locale);
		}
	}
671288
public function setLanguage($lang)
	{
		$this->lang     = $lang;
		$this->metadata = $this->getMetadata($this->lang);

		return $this;
	}
747809
public function set($lang) {
    if (!array_key_exists($lang, $this->getList())) {
      throw new LanguageNotPresentException;
    }
    $this->locator->set($lang);
    return $lang;
  }
1080527
public static function get($args, $lang = null)
    {
        $lang = !is_null($lang) ? $lang : self::getLanguage();
        $args = is_array($args) ? $args : [$args, null];

        $text = $args[0];
        //unset($args[0]);

        $hash = md5($text);

        if (count(self::$translations) == 0) {
            if (file_exists(self::getFilePath())) {
                $json = file_get_contents(self::getFilePath());
                self::$translations = json_decode($json, true);
            }
        }

        if (isset(self::$translations[$hash])
            && isset(self::$translations[$hash][$lang])
        ) {
            if (!empty(self::$translations[$hash][$lang])) {
                $args[0] = self::$translations[$hash][$lang];
                return call_user_func_array('sprintf', $args);
            }
        } else {
            self::$translations[$hash]['origin'] = $text;
            foreach (self::getAvailableLanguages() as $language) {
                if (!isset(self::$translations[$hash][$language])) {
                    self::$translations[$hash][$language] = '';
                }
            }
            $json = json_encode(
                self::$translations,
                JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE
            );
            file_put_contents(self::getFilePath(), $json);
            self::$translations = json_decode($json, true);
        }

        return call_user_func_array('sprintf', $args);
    }
941182
private function loadLanguageData(string $language = 'de')
  {
    if (\in_array($language, self::$availableLanguages, true) === false) {
      throw new StopWordsLanguageNotExists('language not supported: ' . $language);
    }

    $this->stopWords[$language] = $this->getData($language);
  }
464114
public static function set($lang = NULL) {
        $languages = get_config('langs');
        if (!$languages) {
            throw new \Exception(ExceptionMessages::MISCONFIGURED_LANG_CONFIG);
        }

        if (!get_config('lang_default')) {
            throw new \Exception(ExceptionMessages::MISCONFIGURED_LANG_DEFAULT_CONFIG);
        }

        if (empty($lang) || !in_array($lang, $languages)) {
            $lang = get_config('lang_default');
        }

        self::$currentLang = $lang;
        self::load($lang);
    }
1012625
private function loadLanguageFile($name)
    {
        /** @var System $system */
        $system = $this->framework->getAdapter(System::class);
        $system->loadLanguageFile($name);
    }
1058729
protected function initRequest(Lang $lang = null)
    {
        $container = $this->getContainer();

        $request = Request::create($this->getBaseUrl($lang));
        $request->setSession(new Session(new MockArraySessionStorage()));
        $container->set("request_stack", new RequestStack());
        $container->get('request_stack')->push($request);

        $requestContext = new RequestContext();
        $requestContext->fromRequest($request);
        $url = $container->get('thelia.url.manager');
        $url->setRequestContext($requestContext);
        $this->getContainer()->get('router.admin')->setContext($requestContext);
    }
2175
public function setLanguage($lang = 'en', $langDir = __DIR__ . '/lang/')
    {
        $this->lang    = $lang;
        $this->langDir = $langDir;

        $langFile = realpath($langDir . $lang . '.php');
        if (!file_exists($langFile)) {
            throw new \InvalidArgumentException('No such file: ' . $langDir . $lang . '.php');
        }

        $callable = require $langFile;
        $callable($this);

        return $this;
    }