UserAgent::setLanguages

Sets the accepted languages.

@return void
970758
protected function setLanguages()
    {
        if ((count($this->languages) === 0) && ! empty($_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ])) {
            $this->languages = explode(
                ',',
                preg_replace(
                    '/(;\s?q=[0-9\.]+)|\s/i',
                    '',
                    strtolower(trim($_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ]))
                )
            );
        }

        if (count($this->languages) === 0) {
            $this->languages = ['Undefined'];
        }
    }
1163815
public function setLanguage(Event $event)
    {
        /**
         * @var $app Application
         */
        $app = $event->data;
        foreach ($this->handlers as $handler) {
            $intersection = array_intersect($this->languages, $handler->getLanguages());
            if (!empty($intersection)) {
                Yii::$app->language = current($intersection);
                break;
            }
        }
        $app->trigger(self::EVENT_AFTER_SETTING_LANGUAGE);
    }
254956
public function languages($ids)
    {
        if ($this->allCleared === true || $this->isSwitchedOff()) {
            return;
        }

        $ids = (array)$ids;
        $tags = [];
        foreach ($ids as $id) {
            $tags[] = 'language-' . $id;
        }

        $this->cache->invalidateTags($tags);
    }
507488
public function setLanguage($language)
    {
        if (!array_key_exists($language, $this->allowedlanguages)) {
            throw new InvalidArgumentException("Invalid language ISO code");
        }
        $this->parameters['language'] = $language;
    }
1023735
public static function setLanguage($lang)
    {
        static::$_appLanguage = Yii::$app->language;

        Yii::$app->language = $lang;
    }
1047796
protected function setLang() 
    {
        $array = explode(",", $this->_accept_language);
        $ca = count($array);
        for($i = 0; $i < $ca; $i++) 
        {
            //Konqueror
            $array[$i] = str_replace(" ", null, $array[$i]);
            $array[$i] = substr($array[$i], 0, 2);
            $array[$i] = strtolower($array[$i]);
        }
        $array = array_unique($array);
        $this->_lang = strtoupper($array[0]);
        if(empty($this->_lang) || strlen($this->_lang) < 2) 
        {
        	$this->_lang = 'Unknown';
        }
        return true;
    }
319292
public function setLanguage($language)
    {
        if (!is_string($language) || strlen($language) !== 2) {
            throw new MonetivoException('Language format is invalid');
        }
        $language = strtolower($language);

        $this->language = in_array($language, self::$supported_langs) ? $language : 'en';
    }
479006
@Override
  public final void setLang(final Languages pLang) {
    this.lang = pLang;
    if (this.itsId == null) {
      this.itsId = new IdI18nInvItem();
    }
    this.itsId.setLang(this.lang);
  }
138060
public static function setLanguage($language) {
        static::$language = $language;

        static::$message = array();

        $kernalLanguageFolder = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..';
        static::addMessage($kernalLanguageFolder);

        if (defined('API_ROOT')) {
            static::addMessage(API_ROOT);
        }
    }
144882
public function set_diacritic_language( $lang = 'en-US' ) {
		if ( isset( $this->data['diacriticLanguage'] ) && $this->data['diacriticLanguage'] === $lang ) {
			return;
		}

		$this->data['diacriticLanguage'] = $lang;
		$language_file_name              = \dirname( __FILE__ ) . '/diacritics/' . $lang . '.json';

		if ( \file_exists( $language_file_name ) ) {
			$diacritics_file              = \json_decode( \file_get_contents( $language_file_name ), true );
			$this->data['diacriticWords'] = $diacritics_file['diacritic_words'];
		} else {
			unset( $this->data['diacriticWords'] );
		}

		$this->update_diacritics_replacement_arrays();
	}
809807
public function setAcceptLanguageHeader(string $header)
    {
        if (Validation::isValidAcceptLanguage($header)) {
            $this->acceptLanguageHeader = $header;
        } else {
            throw new CustomException('Invalid accept language');
        }
    }
726782
public function setLanguage($iLanguage = null)
    {
        if (!isset($iLanguage)) {
            $this->_iLanguage = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
        } else {
            $this->_iLanguage = $iLanguage;
        }
    }
1092073
protected function setLanguageProperties()
    {
        if (!$this->isInternalRoute()) {

            $langcode = $this->route->getLangcode();

            if (!empty($langcode)) {
                $this->langcode = $langcode;
                $this->translation->set($langcode, $this->current_route['simple_pattern']);
                $this->current_language = $this->language->get($this->langcode);
            }
        }
    }
1329391
protected function initLanguages()
    {
        $this->languageIdList[0] = 0;

        $query      = 'SELECT uid
                         FROM sys_language
                        WHERE hidden = 0';
        $langIdList = DatabaseUtility::getColWithIndex($query);

        $this->languageIdList = $langIdList;
    }
573884
protected function configure()
    {
        $this
            ->setName('chill:main:languages:populate')
            ->setDescription('Load or update languages in db. This command does not delete existing '.
                'languages, but will update names according to available languages')
            ->addOption(
                    self::INCLUDE_REGIONAL_VERSION,
                    null,
                    InputOption::VALUE_NONE,
                    'Include the regional languages. The regional languages are languages with code containing _ excepted '
                        . implode(',', $this->regionalVersionToInclude) . '.')
            ->addOption(
                    self::INCLUDE_ANCIENT,
                    null,
                    InputOption::VALUE_NONE,
                    'Include the ancient languages that are languages with code '
                        . implode(', ', $this->ancientToExclude) . '.')
            ;
    }
724684
public function setLanguage(\Core\Entity\Language $language = null) {
        $this->language = $language;

        return $this;
    }
1253029
public void setBrowserLanguages(com.google.api.ads.admanager.axis.v201902.Technology[] browserLanguages) {
        this.browserLanguages = browserLanguages;
    }