In Magento 2, Where is the value of locale in Magento system? Ex: from database or machine, or some place.

In file: Magento\Framework\Stdlib\DateTime\Timezone

     * {@inheritdoc}
    public function getDateFormat($type = \IntlDateFormatter::SHORT)
        return (new \IntlDateFormatter(

focus this line: $this->_localeResolver->getLocale()


Locale stored in system config (table core_config_data):


By default the locale is set in the Magento\Framework\Locale\Resolver::getDefaultLocale():

public function getDefaultLocale()
    if (!$this->defaultLocale) {
        $locale = $this->scopeConfig->getValue($this->getDefaultLocalePath(), $this->scopeType);
        if (!$locale) {
            $locale = self::DEFAULT_LOCALE;
        $this->defaultLocale = $locale;
    return $this->defaultLocale;

For receiving the current locale use Magento\Framework\Locale\Resolver::getLocale().


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.