How to Extend a List of Languages in Magento 2

Aug 9, 2018415Oleg Semenov
How to Extend a List of Languages in Magento 2

Sometimes you may not find the neccesary language while localizing your website. Here is a short step-by-step tutorial to help you with this issue.

Magento 2 is a multilingual system. It used ResourceBundle for working with locales and had all the locales available in the ICU library.

 

How to extend language list in Magento 2

But for some unknown reasons this list is limited. The limitations are located in Magento\Framework\Locale\Config in the _allowedLocales property. Magento 2 uses the getAllowedLocales public function for getting the list of locales.

 

Adding an unavailable language

First of all, create a plugin:

Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey

Then enable the plugin in the di.xml file:

After that, we need to run the bin/magento setup:upgrade for applied plugin command in the console.

Here is what we will see as a result:

How to extend language list in Magento 2

That’s it, now you have the necessary language on the list.

 


Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Andrey

Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *