How Can I Set Magento 2 Locale Programmatically

How can I set Magento 2 locale programmatically

You can use localeInterface to set Magento 2 locale programmatically.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

$localeInterface = $objectManager->create('Magento\Framework\Locale\ResolverInterface');

$localeInterface->setLocale('en_AU');

$localeInterface->setDefaultLocale('en_AU');
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments