I have a site that has a few different countries that speak the same language but want to have them as different Locales.

  • Mexico (english)
  • Mexico (spanish)
  • USA (english)
  • USA (spanish)
  • Peru (english)
  • Peru (spanish)

These might all share some content but the manager of each region might want to change the content for their own region.

How can I add in new Locales in the locale list in Craft?


There are several locales that Yii comes with but Craft doesn't, simply to keep Craft's filesize down a bit (they add a lot of weight). You can see the master list of Yii locales here: https://github.com/yiisoft/yii/tree/master/framework/i18n/data - If you see a locale in there you want that Craft doesn't come with, just view the raw version of the file on GitHub and then save it to your craft/app/framework/i18n/data/ folder. Then Craft will start supporting it.

If you need a locale that Yii doesn’t offer, find the closest locale Yii/Craft does come with, and copy it with a new name (e.g. en_us.php => en_mx.php).

| improve this answer | |
  • Is this safe for when the system updates? I am just thinking there should be a top level directory not so deep rooted into the framework to do this. – Andrew Smith Aug 30 '14 at 0:40
  • It should be safe, yeah. We will be making this process easier in the future for sure, but this is how you can do it today :) – Brandon Kelly Aug 30 '14 at 4:05

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