Search code examples
magentolocale

How do I create a custom locale in Magento?


The locale I need is not included in the standard Magento language extensions, so I need to create my own.

It will be es-us - Spanish language for the US.

I found this article: http://kb.magenting.com/content/14/50/en/translate-magento-interface-magento-localization-tips.html

It says:

"If there are no localization package for your locale you can create it by simply copying localization directory from English or any other translation."

Can someone walk me through how I get from that quote to having Spanish (USA) in the locale drop-down?

Thank you so much for your help!


Solution

  • Unfortunately, it looks as if the locale names are hardcoded in Mage_Core_Model_Locale_Config. Not only that, but language codes are installed in the database during install.

    What I would recommend doing instead of rewriting that class to define your own custom language is to "piggyback" on another locale and use their code for your custom language pack. For example, in app/locale, you could place the folder gl_ES, copy over a Spanish language pack, and make the modifications you need for that language. Then for your store's locale in the dropdown (System > Configuration > General > Locale) you can choose Galician (Galician)

    The custom solution that you're requesting I think would involve rewriting Mage_Core_Model_Locale_Config to add your new locale to the $_allowedLocales variable. I thought you may need to add the language to the core_language table but it looks as if that table's been deprecated.