Check so Locale settings (country, currency, language) are set.

@throws KlarnaException
@return void
786
private function _checkLocale()
    {
        if (!is_int($this->_country)
            || !is_int($this->_language)
            || !is_int($this->_currency)
        ) {
            throw new Klarna_InvalidLocaleException;
        }
    }
140552
public static function applyConfigValues()
    {
        $settings = self::instance();
        Config::set('app.locale', $settings->locale);
        Config::set('app.fallback_locale', $settings->fallback_locale);
    }
1075965
protected function setLanguage()
	{
		$matches = array();
		if ($this->owner->user->hasState('__locale'))
			$language = $this->owner->user->getState('__locale');
		else if (preg_match('/^\/([a-z]{2}(?:_[a-z]{2})?)\//i',
			substr($this->owner->request->url, strlen($this->owner->baseUrl)), $matches) !== false
			&& isset($matches[1], $this->languages[$matches[1]]))
			$language = $matches[1];
		else
			$language = $this->defaultLanguage;

		$this->owner->language = $language;
	}
770381
public function setLocale(Locale $newLocale) {
		
		// apply some changes only if new Locale really differs
		if (!$this->currentLocale or ($this->currentLocale and $newLocale->id != $this->currentLocale->id)) {
			
			$this->currentLocale = $newLocale;
				
			// if new language code equals the default one, move lang-strings
			if ($this->defaultLocale and $newLocale->id == $this->defaultLocale->id) {

				$this->strings = $this->defaultStrings;
				$this->defaultStrings = NULL;
				
			// otherwise reload current strings
			} else {
			
				$this->strings = NULL;
				$this->loadStrings();
				
			}
			
		}
		
		// set current locale to all categories
		setlocale(LC_ALL, str_replace('-', '_', $newLocale->getRepresentation()) . '.UTF-8');
		
	}
302352
private boolean isCurrentLanguageSetting(Context context, Locale locale) {
        return locale.toString().equals(LanguageSetting.getLanguage(context).toString());
    }
719360
private void setLocale(Locale l, boolean select) {
		Locale oldLocale = locale;
		locale = l;
		int n = 0;

		if (select) {
			for (int i = 0; i < localeCount; i++) {
				if (locales[i].getCountry().length() > 0) {
					if (locales[i].equals(locale))
						setSelectedIndex(n);
					n += 1;
				}
			}
		}

		firePropertyChange("locale", oldLocale, locale);
		if(component != null) {
		    component.setLocale(l);
		}
	}
1068805
protected function setSystemLocale()
    {
        $u = new User();
        $lan = $u->getUserLanguageToDisplay();
        $loc = Localization::getInstance();
        $loc->setContextLocale(Localization::CONTEXT_UI, $lan);
    }
192218
private function applyDefaults(): void
    {
        $timezone = $this->config->get('timezone');
        if ($timezone != null) {
            date_default_timezone_set($timezone);
        }

        $encoding = $this->config->get('encoding');
        if ($encoding != null) {
            mb_internal_encoding($encoding);
            ini_set('default_charset', $encoding);
        }

        $locales = $this->config->get('locales');
        if ($locales != null) {
            foreach ((array) $locales as $category => $locale) {
                setlocale($category, $locale);
            }
        }
    }
1064451
protected function resetGlobalSettings()
    {
        if (Yii::$app instanceof \yii\web\Application) {
            Yii::$app->assetManager->bundles = [];
        }
    }
490573
protected function defineIniSettings(): void
    {
        $this->setTimezone();
        ini_set('memory_limit', '-1');

        if (extension_loaded('Zend OPcache') && ini_get('opcache.enable') && ini_get('opcache.enable_cli')) {
            if (ini_get('opcache.save_comments')) {
                ini_set('opcache.load_comments', '1');
            } else {
                ini_set('opcache.enable', '0');
            }
        }

        if (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.save_comments') === 0) {
            throw new RuntimeException('Please enable zend_optimizerplus.save_comments in php.ini.');
        }
    }
46038
public void setLocale(final Locale locale) {
        if (!equals(this.locale, locale)) {
            this.locale = locale;
            super.setValue(toString(locale));
            i18nBundleProvider.reloadBundles(locale);
        }
    }
1142320
private function _checkCountry(&$country)
    {
        if (!isset($country)) {
            throw new Klarna_ArgumentNotSetException("Country");
        }
        if (is_numeric($country) && !is_int($country)) {
            $country = intval($country);
        }
        if (!is_numeric($country) || !is_int($country)) {
            throw new Klarna_InvalidTypeException("Country", "integer");
        }
    }
16008
void setLanguage(final Locale locale) {

        if (!m_languageSelect.getValue().equals(locale)) {
            m_languageSelect.setValue(locale);
        }
    }
612597
public void setLocales(Locale... locales) {

    String[] array = new String[locales.length];
    for (int i = 0; i < locales.length; i++) {
      array[i] = locales[i].toString();
    }
    setLocales(array);
  }
1219026
protected function setLocale()
    {
        $locale = $this->app['config']['app.locale'];
        $fallbackLocale = $this->app['config']['app.fallback_locale'];

        Punic::setDefaultLocale($locale);
        Punic::setFallbackLocale($fallbackLocale);
    }
900221
public static function setDefault()
    {
        if(!self::$default) {
            $languages = Language::all();
            if($languages) {
                $getDefault = $languages->where('isDefault', true);

                if ($getDefault) {
                    self::$default = $getDefault->first();
                    self::$current = self::$default; //current language is the same as default one in this phase

                    App::setLocale(self::$default->slug);
                    Carbon::setLocale(self::$default->slug);
                    return;
                }
            }

            throw new \Exception("Default language could not be found. Please check if a default language is defined in Administration");
        }
        return;
    }
1300146
public function setLocale()
    {
        // Initialize Locale if set and configured.
        if ($this['language']->enabled() && $this['config']->get('system.languages.override_locale')) {
            $language = $this['language']->getLanguage();
            setlocale(LC_ALL, \strlen($language) < 3 ? ($language . '_' . strtoupper($language)) : $language);
        } elseif ($this['config']->get('system.default_locale')) {
            setlocale(LC_ALL, $this['config']->get('system.default_locale'));
        }
    }