0

In Magento 2, I get wrong locale which I set in system config?

The first, I go to admin->set config locale is Japanese. enter image description here

And then, I go to class "\Magento\Framework\Stdlib\DateTime\Timezone"

....
    /**
     * {@inheritdoc}
     */
    public function getDateFormat($type = \IntlDateFormatter::SHORT)
    {
        var_dump($this->_localeResolver->getLocale());
        return (new \IntlDateFormatter(
            $this->_localeResolver->getLocale(),
            $type,
            \IntlDateFormatter::NONE
        ))->getPattern();
    }
.......

And then I got the result: "en_US".
Did you see the same issue in your system?
If you have solution, may you help me please?

2
  • What are you trying to achieve with the getDateFormat() ? Apr 29, 2016 at 8:43
  • the first, I would like to get "ja_JP" locale, and then I get the date format of Japanese( "yyyy/MM/dd").
    – MrTo-Kane
    Apr 29, 2016 at 8:47

2 Answers 2

0

I see only one reason why this happens - incorrect locale was set in the configuration. Please check your configuration ("store view" scope):

enter image description here

In a debug I see that magento works fine.

Configuration (ja_JP):

config

Result (ja_JP as set):

result

0

I found my issue, because my admin account set locale is "US".
My solution here: set interface locale is Japanese.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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