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(
$this->_localeResolver->getLocale(),
$type,
\IntlDateFormatter::NONE
))->getPattern();
}
focus this line: $this->_localeResolver->getLocale()
Best Answer
Locale stored in system config (table
core_config_data
):By default the locale is set in the
Magento\Framework\Locale\Resolver::getDefaultLocale()
:For receiving the current locale use
Magento\Framework\Locale\Resolver::getLocale()
.