Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Practical Test [Shadi]

Preperation

First test (tick)

  • ✅ i18n service updated

  • ❌ Waffel activated

  • ❌ Translations pulled

  • XBLOCK_TRANSLATIONS_DIRECTORY correctly set

  • ❌ XBlock OEP-19 support added

  • ❌ XBlock local translations removed

i18n service updated. Installing drag&drop after our i18n fixes and seeing it translating text correctly. Checking in studio container. The XBlock source is in src directory so containers can see it in edx/src

Code Block
docker-compose exec studio env TERM=xterm-256color bash -c 'pip uninstall --yes xblock-drag-and-drop-v2'
docker-compose exec studio env TERM=xterm-256color bash -c 'rm -Rf /edx/src/xblock-drag-and-drop-v2/build'
docker-compose exec studio env TERM=xterm-256color bash -c 'pip install /edx/src/xblock-drag-and-drop-v2'
docker-compose exec studio env TERM=xterm-256color bash -c 'paver update_assets'
make studio-restart

...

Works fine, HTML and JS

Second test (tick)

  • ✅ i18n service updated

  • ✅ Waffel activated

  • (error) Translations pulled

  • (error) XBLOCK_TRANSLATIONS_DIRECTORY correctly set

  • (error) XBlock OEP-19 support added

  • (error) XBlock local translations removed

Enabling the waffle switch before pulling anything

Exception!

Code Block
AttributeError at /course/course-v1:SN+SN2+2023
'ErrorBlockWithMixins' object has no attribute 'raw_grader'
Request Method:	GET
Request URL:	http://localhost:18010/course/course-v1:SN+SN2+2023
Django Version:	3.2.19
Exception Type:	AttributeError
Exception Value:	
'ErrorBlockWithMixins' object has no attribute 'raw_grader'
Exception Location:	/edx/app/edxapp/edx-platform/cms/djangoapps/models/settings/course_grading.py, line 30, in __init__

After tracing the error, it is caused by our code:

Code Block
File "/edx/app/edxapp/edx-platform/xmodule/modulestore/django.py", line 414, in get_python_locale_directory
xblock_module_name = xblock_resource.__name__
AttributeError: 'str' object has no attribute '__name__'

I fixed it to be:

Code Block
 - xblock_module_name = xblock_resource.__name__
 + import importlib
 + xblock_resource = importlib.import_module(xblock_class.__module__)

Now I got an error for missing XBLOCK_TRANSLATIONS_DIRECTORY setting

Added the variable to devstack.py temporarily. Now it is rendering from old translations nicely. The XBLOCK_TRANSLATIONS_DIRECTORY I added is a non-existence directory. Nice!

Third test (tick)

  • ✅ i18n service updated

  • ✅ Waffel activated

  • (error) Translations pulled

  • (error) XBLOCK_TRANSLATIONS_DIRECTORY correctly set

  • ✅ XBlock OEP-19 support added

  • (error) XBlock local translations removed

XBlock has atlas support and still has the original local translation

Result: Same problem in the Second test,,,,, fixed the same way

Working fine, still loading local translations

Fourth test (tick)

  • ✅ i18n service updated

  • ✅ Waffel activated

  • ✅ Translations pulled

  • (error) XBLOCK_TRANSLATIONS_DIRECTORY correctly set

  • ✅ XBlock OEP-19 support added

  • (error) XBlock local translations removed

Pulling translations: pulled successfully. But not compiled

Running cd conf && i18n_tool generate , compiled successfully. But before compilation, I changed few translations of Arabic language so I can see if translations are pulled from local or oep-19 directory without setting annoying logs

No JS compilation made so far!

Python translation didn’t read from atlas directory. Expected since XBLOCK_TRANSLATIONS_DIRECTORY is not set correctly

Fifth test ❗

  • ✅ i18n service updated

  • ✅ Waffel activated

  • ✅ Translations pulled

  • XBLOCK_TRANSLATIONS_DIRECTORY correctly set

  • ✅ XBlock OEP-19 support added

  • (error) XBlock local translations removed

Still doesn’t read from Atlas directory! checking…

Error loading the translation directory

  • First issue, my fix in Second Test is not correct, because it is damaged legacy loading. Reverting and then updating:

Code Block
- xblock_module_name = xblock_resource.__name__
+ xblock_module_name = xblock_resource  # xblock_resource is a string
  • Second issue: the domain for translation is set to text , I had to rename it to django. But this will damage backward compatibility, this must be encapsulated in a check for the waffle, or better to pull block translations into text.po instead of django.po

  • Third issue, the result of xblock_module_name is drag_and_drop_v2.drag_and_drop_v2 while the translation is in drag_and_drop_v2

After manually changing the directory name pulled by Atlas, translations for Django Templates read from Atlas successfully

...

Java Script translations are not loaded from Atlas yet! The text.js does not exist yet