Checks/fixes to the language input is valid.

@param int &$language {@link KlarnaLanguage Language} constant.

@throws KlarnaException
@return void
164871
private function _checkLanguage(&$language)
    {
        if (!isset($language)) {
            throw new Klarna_ArgumentNotSetException("Language");
        }
        if (is_numeric($language) && !is_int($language)) {
            $language = intval($language);
        }
        if (!is_numeric($language) || !is_int($language)) {
            throw new Klarna_InvalidTypeException("Language", "integer");
        }
    }
742989
public function sanitizeLanguage($language)
    {
        if ( 0 === count($this->languages) ) {
            throw new RuntimeException('Polyglot features no supported languages.');
        }

        if ( ! $this->isSupported($language) ) {
            $language = $this->getFallbackLanguage();
        }

        return $language;
    }
94064
protected function submitEditLanguage()
    {
        if ($this->isPosted('delete')) {
            $this->deleteLanguage();
        } else if ($this->isPosted('save') && $this->validateLanguage()) {
            if (isset($this->data_language['code'])) {
                $this->updateLanguage();
            } else {
                $this->addLanguage();
            }
        }
    }
507488
public function setLanguage($language)
    {
        if (!array_key_exists($language, $this->allowedlanguages)) {
            throw new InvalidArgumentException("Invalid language ISO code");
        }
        $this->parameters['language'] = $language;
    }
1373883
public function addLanguage($language)
    {
        $this->backup();

        file_put_contents($this->languageFilesPath.DIRECTORY_SEPARATOR."$language.json",
            json_encode((object) [], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)
        );
    }
462639
public function set_hyphenation_language( $lang = 'en-US' ) {
		if ( isset( $this->data['hyphenLanguage'] ) && $this->data['hyphenLanguage'] === $lang ) {
			return; // Bail out, no need to do anything.
		}

		$this->data['hyphenLanguage'] = $lang;
	}
463624
public function setKeyword($keyword, $language = null)
    {
        if (empty($language)) {
            $language = $this->mainLanguageCode;
        }

        if (!is_array($this->keywords)) {
            $this->keywords = [];
        }

        $this->keywords[$language] = $keyword;
    }
723323
public static function detect(Language $language, AcceptLanguage $acceptLanguage)
    {
        $acceptLanguageString = $acceptLanguage->getAcceptLanguageString();
        $languages = array();
        $language->setLanguages($languages);

        if (!empty($acceptLanguageString)) {
            $httpLanguages = preg_split(
                '/q=([\d\.]*)/',
                $acceptLanguageString,
                -1,
                PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
            );

            $key = 0;
            foreach (array_reverse($httpLanguages) as $value) {
                $value = trim($value, ',; .');
                if (is_numeric($value)) {
                    $key = $value;
                } else {
                    $languages[$key] = explode(',', $value);
                }
            }
            krsort($languages);

            foreach ($languages as $value) {
                $language->setLanguages(array_merge($language->getLanguages(), $value));
            }
        }
    }
371182
public void setLang(java.lang.String lang) {
        getStateHelper().put(PropertyKeys.lang, lang);
        handleAttribute("lang", lang);
    }
726782
public function setLanguage($iLanguage = null)
    {
        if (!isset($iLanguage)) {
            $this->_iLanguage = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
        } else {
            $this->_iLanguage = $iLanguage;
        }
    }
1272965
function setLanguage () {
		if (!defined('LANGUAGES')){
			define('LANGUAGES', 'en');
		}	
		$this->i18nURL();
		if (!defined('LANG')){
			if (!$this->lang){
				$this->lang = 'en';
			}
			define('LANG', $this->lang);
		}
	}
1204607
public static function set($language = null)
    {
        self::$messages = array();
        $language = $language ?: self::$config['language'];
        $filename = Atomik::findFile("$language.php", Atomik::path(self::$config['dir']));
        if ($filename === false) {
            throw new AtomikException("Language '$language' does not exists");
        }
        
        $messages = include $filename;
        if (is_array($messages)) {
            self::$messages = array_merge(self::$messages, $messages);
        }
        
        Atomik::set('app.language', $language);
        self::$config['language'] = $language;
        if (isset($_SESSION)) {
            $_SESSION['__LANG'] = $language;
        }
    }
899670
public function setSourceLanguage(string $language): void
    {
        $this->xliff->setSourceLanguage($language);
        $this->markChanged();
    }
1370872
public function setLanguage($value)
    {
        //$value = strtolower($value);
        if (!isset($this->_models[$value])) {
            $this->_models[$value] = $this->getNewTranslation($value);
        }
        $this->_language = $value;
    }
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);
        }
    }
369670
protected function validateLanguage()
    {
        $this->setSubmitted('language');
        $this->setSubmittedBool('status');
        $this->setSubmittedBool('default');
        $this->setSubmitted('update', $this->data_language);

        $this->validateComponent('language');

        return !$this->hasErrors();
    }
198268
public function setLanguageId( $langid )
	{
		if ( $langid == $this->getLanguageId() ) { return; }

		$this->_checkLanguageId( $langid );
		$this->_values['langid'] = $langid;
		$this->setModified();
	}