cancel
Showing results for 
Search instead for 
Did you mean: 

we need to add new custom locale

we need to add new custom locale

We need to add a new locale no_NO to our website

This locale must be shown in locales list in Store->Configuration->General->Locale Options->Locale

locales.png

1 REPLY 1

Re: we need to add new custom locale

Hello @suj_eet 

 

You can add in runtime without adding in database :

 

/vendor/magento/module-config/Model/Config/Source/Locale.php


public function toOptionArray()
    {
         //return $this->_localeLists->getOptionLocales();
        $localeLists=$this->_localeLists->getOptionLocales();
        $localeLists[] = ['value'=>'kb_IQ', 'label'=>"Kurdish Bahdini (Iraq)"];
        $localeLists[] = ['value'=>'ks_IQ', 'label'=>"Kurdish Sorani (Iraq)"];
        return $localeLists;
    }


Hope it helps !

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy