How to translate indigo theme in different languages? I have to translate my home page http://local.edly.io:8000/ and http://local.edly.io:8000/courses

Hey @community, I am new here. I am working on a Tutor and the indigo theme. I am trying to translate my whole platform in different languages. MFE is translating properly, but problem is my indigo theme is not translating.

Does anyone know how to translate the indigo theme?

I want to translate my home page http://local.edly.io:8000/ which is comes from indigo theme.

Thank you in advance

Hi @Ronak_Pansuriya1 ,
There is no direct way to do this. You can follow below steps for translations:

  • Create a folder tutor-indigo/tutorindigo/conf/locale/en/LC_MESSAGES.
  • Mount indigo theme to lms container at this path edx-platform/themes
  • Run command make extract_translations in lms container
  • Now, Navigate to edx-platform/conf/locale/en/LC_MESSAGES and copy the translations of indigo theme.
  • Paste the translations there into a new django.po file in tutor-indigo/tutorindigo/conf/locale/en/LC_MESSAGES.
  • Now, tutor config save and start. It will pick the translations automatically.
2 Likes

You can fork openedx-translations like I did:

Then, add your translations there and update the config.yml to point to your fork instead of the default:
https://github.com/openedx/openedx-translations → https://github.com/{username}/openedx-translations

ATLAS_REPOSITORY: boomboom0202/openedx-translations
ATLAS_REVISION: main

Here’s how I solved this.

 Preview of my project directory structure:
 
 - tutor/
   - data/
   - env/
   - config.yml

 - tutor-plugins/
   - tutor-indigo/ # clone of original repository

1. Create django.po file for tutor-indigo translations.

Create tutor-plugins/tutor-indigo/tutorindigo/locale/de_DE/LC_Messages/django.po.

Then add a translation:

# #-#-#-#-# header #-#-#-#-#

msgid ""
msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

# #-#-#-#-# header #-#-#-#-#

msgid "Discover courses"
msgstr "Kurse suchen"

Note: If you don’t add a header entry with the charset specification, as soon as your django.po file starts to references non ASCII characters, translation compilation breaks. msgfmt tries to warn you:
msgfmt: input file doesn't contain a header entry with a charset specification

2. Install gettext tools and compile translations.

(MacOS)

brew install gettext

(Ubuntu/Debian)

sudo apt update
sudo apt install gettext

Compile translations

msgfmt django.po -o django.mo

Note: msgfmt comes from gettext tools

3. Copy translations directory to Docker Build context (manually).

cp -R "./tutor-plugins/tutor-indigo/tutorindigo/locale" "tutor/env/build/openedx"

Note: I was hesitant to do this at first because I thought this entire build/openedx directory rebuilt for every tutor config save run—not the case (however build/openedx/Dockerfile does).

4. Patch the Dockerfile.

Since I already have the tutor-indigo plugin, I just updated it’s plugin.py file.

hooks.Filters.ENV_PATCHES.add_item((
   "openedx-dockerfile-pre-assets",
   """
COPY --chown=app:app ./locale /openedx/extra_locale
""" ))

Note: We patch at openedx-dockerfile-pre-assets. At this point in the dockerfile the app user is already created and the default edx translations are pulled and compiled. Also our translations are already in the Docker build context (tutor/env/build/openedx) so we can safely copy the locale directory into the image filesystem.

5. Patch the lms.env.yml and cms.env.yml configs.

hooks.Filters.ENV_PATCHES.add_item((
    “lms-env”,
    “”"
LOCALE_PATHS: [“/openedx/extra_locale”]
“”"))
hooks.Filters.ENV_PATCHES.add_item((
    “cms-env”,    
    “”"
LOCALE_PATHS: [“/openedx/extra_locale”]
“”"))

Note: This helps edx find additional translations to use.

6. Install the plugin. Build the openedx image. Restart the containers.

pip install "./tutor-plugins/tutor-indigo"
tutor plugins enable indigo
tutor images build openedx
tutor local reboot