3

I am in the process of building my first multilingual Craft site.

The site will have two languages:

  • English (default)
  • Spanish

When setting up the site, I chose U.S. English and Spanish - United States as the respective locales.

I am now thinking it might be better to keep the languages less specific to the United States and would like to switch the two to English and Spanish.

My question is if it is possible to do this without losing any content that has already been entered under both U.S. English and Spanish - United States.

Thanks!

| improve this question | | | | |
8

Currently it's not possible to edit a locale from the CP, which means you have to edit it directly in your db.

Edit locale:

UPDATE craft_locales SET locale = 'en' WHERE locale = 'en_us';

Edit elements:

Each element (entries, assets, users, etc.) which can be translated has a locale-column:

UPDATE craft_categorygroups_i18n SET locale = 'en' WHERE locale = 'en_us';
UPDATE craft_content             SET locale = 'en' WHERE locale = 'en_us';
UPDATE craft_elements_i18n       SET locale = 'en' WHERE locale = 'en_us';
UPDATE craft_entryversions       SET locale = 'en' WHERE locale = 'en_us';
UPDATE craft_sections_i18n       SET locale = 'en' WHERE locale = 'en_us';

Edit permissions:

UPDATE craft_userpermissions SET name = 'editlocale:en' WHERE name = 'editlocale:en_us';

Check:

To be sure you've got them all do a sql search for en_us.

| improve this answer | | | | |
  • Awesome. This worked perfectly. I was able to update all en_us entries to en and es_us entries to es. Thanks! – Chad Clark Aug 3 '14 at 18:33

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.