0

I have a multilingual site with English as default language.

The language code for English is currently en but I want to convert it to en-US.

I thought about adding a new language with the correct langcode, but I don’t think that’s the best solution since I have a lot of translated content, and I don’t want to add all the translations again for the new language.

Is it possible to update a current language's language code, if not, what can I then do?

TL;DR I have a bunch of languages on my site, and I want to update all of their language codes without loosing my translations.

  • These files are only translation strings. A language exports/imports as language.entity.[ID].yml. You can add custom languages also in /admin/config/regional/language/add. But I'm not sure if you can convert a language. – 4k4 Dec 2 at 21:59
  • Yeah, I know. But the problem is that I have to add all the translations again if I add a new language. – Jdrupal Dec 2 at 22:01
  • I don't know what is in the .pot file, but normally there is not much to translate from english to english. I think the bigger problem is how you can update the language code in entity tables. – 4k4 Dec 2 at 22:21
  • Oh yeah, of course. Maybe I can create an update hook that copies the translations over. – Jdrupal Dec 2 at 22:24

Your Answer

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

Browse other questions tagged or ask your own question.