[XBlocks] Translation guidelines questions

384 views
Skip to first unread message

openedX Developer

unread,
Mar 29, 2017, 2:45:04 PM3/29/17
to openedx-translation
Hi all,

I am struggling with the XBlocks' translation process. I tried to install the ones that should have the translations in place (like i.e. ORA2 [1]) with no luck; I also tried to implement my custom XBlock following the Internationalization guidelines[2] but they won't get applied. What I noticed is that the strings that exist in the `conf/locale/<lang_code>/LC_MESSAGES/django.mo` file get correctly translated in the XBlock's template (like e.g. the "Submit" string on a button) but whatever stays inside the XBlock's local `django.po` file is not read. 
My way to solve this issue was to instruct Django to look also inside the XBlock's translations folder by programmatically adding the XBlocks' paths to the `settings.LOCALE_PATH` during startup. However my question is: is this the way it is supposed to be? How does `edx.org` handle XBlocks' translations? Should the content of the XBlocks' local `translations` folder be automatically read by the i18n service?

Thank you for your attention.

Andy Armstrong

unread,
Mar 29, 2017, 3:20:32 PM3/29/17
to openedx-t...@googlegroups.com
Hi,

I'm not sure how this functionality works, but I'm happy to try to work it out with you. As an experiment, I went to edx.org and switched my language to French, and I can see that the ORA2 pages are being translated:

Inline image 1

It seems that the process we use is different from what you are doing, so we should work out what is different.

My understanding is that the ORA2 Python library is packaged with its translations inside it. When it is pip installed into edx-platform, those translations are picked up automatically by Django. You can see the following ORA release PR where the translations were recently updated:


My initial thought is that you have two options for updating the translations in ORA2:

1. Update your ORA2 translations in Transifex, and then create a PR (or request that edX create one) to create a new ORA2 release
2. Create a fork of ORA2 and follow the same process for your own copy.

In case it helps, here is some material on the processes:

 - The basic Transifex process is documented here:  https://github.com/edx/edx-platform/wiki/Internationalization-and-localization
 - The ORA2 release process is documented here: https://openedx.atlassian.net/wiki/display/ENG/ORA2+Release+Process

Does this help? If not, what process are you trying to follow?

Thanks,

 - Andy



--
You received this message because you are subscribed to the Google Groups "openedx-translation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openedx-translation+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openedx-translation/05d2a11c-f10d-4d0f-b0a4-e071fc82acbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Andy Armstrong

edX | UI Architect  | an...@edx.org  

141 Portland Street, 9th floor

Cambridge, MA 02139

http://www.edx.org

http://www.e-learn.nl/media/blogs/e-learn/edX_Logo_Col_RGB_FINAL.jpg?mtime=1336074566

Leonardo OpenedX Intern

unread,
Mar 30, 2017, 7:53:19 PM3/30/17
to openedx-t...@googlegroups.com
Hi Andy, thank you very much for your reply.

I believe the reason why that specific XBlock is correctly translated is because it is declared inside Django's INSTALLED_APPS (see here[1]). That is the only XBlock that I'm aware of doing that. Now, if you check this [2], you can see how Django handles the translations by checking in several places. That is the reason why I added my XBlock's local translations folder to the LOCALE_PATHS. Anyway, I've just checked and it seems that the same correct behavior is applied by following ORA2's approach of adding the XBlock to the INSTALLED_APPS list. 

Now this raises a question: is there a particular reason why just ORA2 has to appear in that list? Is open edX referring to that list in a particular way or it is safe to add all the XBlocks that I want to translate to that list?

I was afraid that adding an XBlock to that list would somehow enable it by default in all of my courses as an "advanced component" overriding the "advanced parameters list"  that appears in the "settings/advanced" configuration page of a course, but I tried a couple of times and it seems that this is not happening, so it "should" be safe to add it, right?

Thank you for your time.

Best regards



To unsubscribe from this group and stop receiving emails from it, send an email to openedx-translation+unsubscribe...@googlegroups.com.
--

Andy Armstrong

edX | UI Architect  | an...@edx.org  

141 Portland Street, 9th floor

Cambridge, MA 02139

http://www.edx.org

http://www.e-learn.nl/media/blogs/e-learn/edX_Logo_Col_RGB_FINAL.jpg?mtime=1336074566

--
You received this message because you are subscribed to the Google Groups "openedx-translation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openedx-translation+unsub...@googlegroups.com.

Andy Armstrong

unread,
Mar 31, 2017, 9:53:03 AM3/31/17
to openedx-t...@googlegroups.com
Hi Leonardo,

Thanks, that makes a great deal of sense. Note that ORA2 provides both a Django app and an XBlock, and the former is why it is added to INSTALLED_APPS. It seems that it is a side-effect of this that allows the XBlock translations to work. I don't see any particular down-side to adding an XBlock to INSTALLED_APPS, as long as the feature still works. In fact, we have started discussing whether we should be converting XBlocks to be built upon Django, in which case this would all just work as expected. You can see some of our thinking in this proposal:


Let us know if this does or doesn't work for you.

 - Andy



--
You received this message because you are subscribed to the Google Groups "openedx-translation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openedx-translation+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Leonardo OpenedX Intern

unread,
Mar 31, 2017, 6:41:48 PM3/31/17
to openedx-t...@googlegroups.com
Hi Andy,

thanks for your reply. I will try again with other XBlocks and I'll keep you posted. 

However, I am still wondering if this is the correct way of proceeding for XBlocks which are not explicitly Django apps. By reading the documentation of the `drag-and-drop` XBlock [1] it seems that the capability of the LMS to detect and apply the local XBlock's translations is not working at the moment (see the final Note in that section). Unfortunately I don't have access to the ticket [2] where this issue is being tackled, but maybe that could help us to understand which is the proper way of handling translations.

Thank you also for the link, I will study the proposal. 

Best regards.





--

Andy Armstrong

edX | UI Architect  | an...@edx.org  

141 Portland Street, 9th floor

Cambridge, MA 02139

http://www.edx.org

http://www.e-learn.nl/media/blogs/e-learn/edX_Logo_Col_RGB_FINAL.jpg?mtime=1336074566

--
You received this message because you are subscribed to the Google Groups "openedx-translation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openedx-translation+unsub...@googlegroups.com.

Lupus Furyo

unread,
Feb 26, 2019, 1:59:49 PM2/26/19
to openedx-translation
Hello,
I know this is a long shot since the post was made back in 2017.
It is 2019 now, and I am having similar issues with all XBlocks that are not officially part of Django.
In particular, before seeing this post, I installed and tested the following XBlocks: ubcpi (https://github.com/ubc/ubcpi) and edx-sga (https://github.com/mitodl/edx-sga).

1. Both are already  translated in several languages. Yet, none of the translated strings are showing up either LMS or CMS side.
2. I also added a new locale/language and followed the standard procedure to translate/localize a third party App. Namely,

    1. I have added new translations for 'ubcpi' to third party installed apps in
       /edx/edx-platform/conf/locale/config.yaml


third_party:
    - wiki
    - edx_proctoring_proctortrack.po
    - ubcpi
      ....
    
generate_merge:
    django.po:
      - django-partial.po
      - django-studio.po
      - mako.po
      - mako-studio.po
      - wiki.po
      - edx_proctoring_proctortrack.po
      - ubcpi.po
      - sga.po

    djangojs.po:
      - djangojs-partial.po
      - djangojs-studio.po
      - underscore.po
      - underscore-studio.po
      - ubcpi.po
      - sga.po

    1. After running
       i18n_tool extract
       i18n_tool generate


and compiling assets
python manage.py lms compilejsi18n --settings=aws --packages=ubcpi
python manage.py lms compilejsi18n --settings=aws --packages=sga

I got all files copied to respective folders (ubcpi and sga) now found in /edx/var/edxapp/staticfiles/

Yet, translations are not showing up in either LMS or CMS.

I tried to follow approach suggested in this post, yet, I cannot locate settings.LOCALE_PATH in Django settings. Where can I find it?

Many thanks in advance for a reply to this question.

Best, L
Reply all
Reply to author
Forward
0 new messages