Open edX localization

Hello,

I’d like to discuss how the Open edX platform is built with a restricted language list and the challenges of adding a new language.

Here’s my experience so far:

  1. Latvian Language Requirement: I need to have the Latvian (lv) language available on the LMS since all courses and learning activities will be conducted in Latvian, following local legislation.
  2. Steps Taken to Add Latvian to Open edX:
  • I translated and reviewed all the *.po files in the Transifex “opened-translations” section.
  • I manually copied the translated files to the “opened-translations-redwood” section, which unexpectedly appeared when I was nearly done with the translations. Unfortunately, opened-translations-redwood section didn’t reflect the changes I had made in the opened-translations.
  • I verified that Latvian (lv) is included in the GitHub openedx/openedx-translations list.

Now, I’m trying to get Latvian working in my Open edX Tutor installation, but I’ve been struggling with several issues:

  1. Language Setting Error: During the interactive setup process with the tutor local launch command, where users can set the default language, I encountered the following error:
The default language code for the platform [en] lv
Error: 'lv' is not one of 'en', 'am', 'ar', 'az', 'bg-bg', 'bn-bd', 'bn-in', 'bs ', 'ca', 'ca@valencia', 'cs', 'cy', 'da', 'de-de', 'el', 'en-uk', 'en@lolcat', 'en@pirate', 'es-419', 'es-ar', 'es-ec', 'es-es', 'es-mx', 'es-pe', 'et-ee', 'eu-es', 'fa', 'fa-ir', 'fi-fi', 'fil', 'fr', 'gl', 'gu', 'he', 'hi', 'hr', 'hu', 'hy-am', 'id', 'it-it', 'ja-jp', 'kk-kz', 'km-kh', 'kn', 'ko-kr', 'lt-lt', 'ml', 'mn', 'mr', 'ms', 'nb', 'ne', 'nl-nl', 'or', 'pl', 'pt-br', 'pt-pt', 'ro', 'ru', 'si', 'sk', 'sl', 'sq', 'sr', 'sv', 'sw-ke', 'ta', 'te', 'th', 'tr-tr', 'uk', 'ur', 'vi', 'uz', 'zh-cn', 'zh-hk', 'zh-tw'.

To resolve this, I found the Interactive.py file where this list is hardcoded and added “lv” to the list, allowing me to proceed with the installation. However, this led to another error:

Loading settings lms.envs.tutor.production >>>>
SystemCheckError: System check identified some issues:
ERRORS:
?: (translation.E004) You have provided a value for the LANGUAGE_CODE setting that is not in the LANGUAGES setting.

Thanks to @omar, I was directed to two files where Latvian should be added: edx-platform/…/common.py and frontend-app-account/…/constants.js. I’m now trying to figure out how to correctly add the necessary lines for Latvian to these files.

Any guidelines, assistance, or shared experiences wit this would be greatly appreciated.

Questions and Concerns:

  1. How can a new language be added to the list? What is the process to edit these files and add a language? Why is this list as it is, and where is it derived from? Why does the language list vary across different sources?
  2. Why is language checked against a predefined list? Can this approach be revisited to make the language settings more flexible?
  3. Could the process of installing language packs and locale settings be incorporated into Tutor based on user input, with a fallback to English (en) if the chosen translation is unavailable?
  4. Localization during Installation: I also noticed during the initial stages of the Open edX Docker image creation that various English locales are installed by default, which are unnecessary for my installation. Could the locale settings be tied to the selected default language?

Any guidance or suggestions on how to address these challenges would be greatly appreciated.

Thank you!

2 Likes

Thanks @elitaleilande for the tag. I’ll review in details and get back to you.

As far as I know, there is no obvious process to do that.

It does seem to me that the edx-platform should not be overriding the default Django value of LANGUAGES. But I’m not quite sure what the implications would be.

I prefer if the installation fails early because of an invalid language code. That being said, the available list of language codes should definitely be extensible from Tutor. We can address this after the issue with LANGUAGES has been fixed upstream.

I’m not sure what you mean by that. We need all languages to be bundled in the Open edX Docker image, such that we can provide a single image to all users, and not one for every different language.

Sorry if I’m mentioning something you already know or if this is irrelevant to the matter—I’m new to this and still learning.
I noticed that when building the Open edX image, during the
=> [minimal 2/2] RUN --mount=type=cache,target=/var/cache/apt,sharing=locked
there’s a message saying “Generating locales… it might take a while…” (or something similar), followed by a list of generated English locales like:


 => => #   en_AG.UTF-8... done
 => => #   en_AU.UTF-8... done
 => => #   en_BW.UTF-8... done
 => => #   en_CA.UTF-8... done
 => => #   en_DK.UTF-8... done
 => => #   en_GB.UTF-8...

and ONLY english related, sorry if this not important.

Indeed, this is not relevant. It’s related to the operating system locale in the Docker image. You can safely ignore these logs, as they are completely unrelated to the edx-platform language settings.