11

Is it possible, by any method, to change the list of available locales? The current list includes some strange entries, e.g. East Germany, and we would like to update this to be more current for our client.

  • Just out of curiosity, what do you use this list for? – carlcs Jul 14 '14 at 14:59
  • The Territories Fieldtype uses it as a master, and it includes some really old choices (East Germany?!). – Dan G Jul 15 '14 at 6:16
8

You can download the locales you want from https://github.com/yiisoft/yii/tree/master/framework/i18n/data and place in your craft/app/framework/i18n/data folder and they will show up as options.

Since Yii ships with so many locales, we initially stripped a lot of them out to keep the Craft download size to something reasonable.

If there are some locales we stripped that you think should be included in Craft, hit us up at support@buildwithcraft.com and we'll get them in.

| improve this answer | |
  • Is the locales functionality agnostic enough that by adding custom locales you could uses this functionality for say a multi-campus site? Our client has multiple campuses however will share the CMS because only some of the content will be different. Client would like urls to reflect which campus they are on, much like a locale does. My thinking (possibly wrong) is using locales to accomplish something like this. However I don't want it to be hacking the CMS to shoehorn what the client needs. – aran Sep 11 '14 at 15:50
  • @aran Indeed. Think of locales as a way of targeting content to a specific user. You'd just be adding a "custom" locale, then. – Brad Bell Sep 11 '14 at 15:52
  • If you create a custom locale and add it to this folder, I'm assuming you'll have to manually add it back after every update? – Jon Horton Nov 14 '14 at 18:05
  • It's unlikely an auto-update would delete your custom locale. If you do a manual update, then probably since you are usually swapping out the whole app folder. – Brad Bell Nov 14 '14 at 18:07
3

Also worth noting: 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).

You may also wish to add it to the 'languages' array within each of your selected locales’ data files, so you can customize what the locale should be labeled as within the CP.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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