Issue with Translation in Open edX Quince

Hi everyone,

I recently launched an Open edX Quince instance using Tutor on an EC2 instance running Ubuntu and selected Hebrew as the site language. However, I have encountered some issues: the LMS is only partially translated into Hebrew, and the MFE is entirely in English.

I followed the custom translation processes as per the Tutor documentation for the LMS and MFE. I obtained the translations from Transifex and rebuilt both the Open edX platform and the MFE, but the translations have not been applied.

Questions:

  • How can I troubleshoot this issue?
  • Did I miss something in the process?

Ultimately, I aim to add customized translations to Hebrew. Any advice or guidance would be greatly appreciated! Thanks in advance.

2 Likes

hi @Yaniv_Gershon ,
language of site is taken from user pref-lang configuration .
so i did some modification function process_response in this file
openedx/core/djangoapps/lang_pref/middleware.py for complete site translation in Hebrew

def process_response(self, request, response):  # lint-amnesty, pylint: disable=missing-function-docstring
        # If the user is logged in, check for their language preference. Also check for real user
        # if current user is a masquerading user,
        user_pref = None
        current_user = None
        if hasattr(request, 'user'):
            current_user = getattr(request.user, 'real_user', request.user)

        if current_user and current_user.is_authenticated:

            # DarkLangMiddleware has already set this cookie
            if DarkLangConfig.current().enabled and get_user_preference(current_user, DARK_LANGUAGE_KEY):
                return response

            anonymous_cookie_lang = getattr(request, '_anonymous_user_cookie_lang', None)
            if anonymous_cookie_lang:
                user_pref = anonymous_cookie_lang
                set_user_preference(current_user, LANGUAGE_KEY, anonymous_cookie_lang)
            else:
                # Get the user's language preference
                try:
                    user_pref = get_user_preference(current_user, LANGUAGE_KEY)
                except (UserAPIRequestError, UserAPIInternalError):
                    # If we can't find the user preferences, then don't modify the cookie
                    pass

            # If set, set the user_pref in the LANGUAGE_COOKIE_NAME
            if user_pref and not is_request_from_mobile_app(request):
                lang_pref_helpers.set_language_cookie(request, response, user_pref)
            else:
                lang_pref_helpers.unset_language_cookie(response)
        else:
            cookie_lang = lang_pref_helpers.get_language_cookie(request)
            if cookie_lang:
                lang_pref_helpers.set_language_cookie(request, response, cookie_lang)
            else:
                lang_pref_helpers.set_language_cookie(request, response, "he")
        return response

and for partially tranlslation , you can add your custom translation in conf/locale/he/LC_MESSAGES/django.po .
hope it work for you

1 Like

Hi Vivek,

Thank you for your detailed response. We’ve identified that the main issue lies with the MFE (Micro-Frontend), which is entirely in English, and this problem persists for any language that is not English. Despite following the custom translation processes from the instructions in GitHub and obtaining translations from Transifex, the translations have not been applied.

Could you please provide additional guidance or solutions specifically for translating the MFE?

Thanks again for your help!

hi @Yaniv_Gershon ,

This is because the language preference defaults to English if not explicitly set by the user. When the platform is first loaded, it defaults to English. If you want your site to support multiple languages, you can follow this guide: How to Enable Multiple Languages for Your Open edX Platform. Alternatively, if you want the platform to be in a specific language, you can follow my solution below


The way translation is handled in the MFEs differ from how the platform handles translations (which is Python gettext based).

The translation framework in MFEs is based on formatjs (Installation | Format.JS).

Instead of .po files the translations lie in .json files. Every language has its own file (per MFE), so to override a specific string in all MFEs, we would have to override it in all translation files in all MFEs This also sometimes applies to decency pkgs, like header, footer…etc.
For custom translations in MFE, you can modify your message files and provide translations in JSON format. Place the translations in the i18n folder structured as i18n/messages/<language>.json.
for Example see screen shot below:


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.