Versions Compared

Key

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

As part of the Django 1.11 upgrade we need to address that they dropped support for the zh-cn language code in Django 1.9 in favor of zh-hans. These are the results of my efforts in trying to figure out where and how we store language codes to make a plan for the update. I was kind of starting from scratch with edx-platform loc so a lot of this is beginner stuff, but may be helpful to other people trying to figure out the whole system end-to-end.

...

Translation packages in play

EdX Platform Translation Python Packages has a list of packages involved in Platform translations as of the time of this writing. Having at least a cursory understanding of them will help with reading this doc.

...

  • Dark / Dark Database (do we need to do both? what do they each do?)
  • Settings files (update settings.LANGUAGES)
  • Transifex (conf/locale)
    • Need to update config.yaml to have a lang_map entry to make sure zh_CN gets correctly downloaded as zh_HANS
      • In the [main] section of .tx/config we need this line:
        • lang_map: zh_CN : zh_HANS
      • This is a 1:1 mapping, we can't download the Chinese translations to both zh_CN and zh_HANS. It's unclear if the download process will delete the old CN translation files or if we can just leave them during the transition. If not we may need to add some shim code to copy the files after they are pulled.
  • What else?

...

  1. Figure out if we can just leave the translations as zh_CN and let Django fall back to that, leaving everything else the same
    1. This will probably fail quickly and spectacularly
  2. Figure out if we can just rename the translations
    1. This will also probably fail
  3. Learn more about how 3rd party packages are using loc and how to integrate them
    1. pdfjs
    2. tinymce
    3. moment
      1. Andy has discovered that Wikipedia had to map zh_hans to zh_cn for moment, we'll likely have to find the right place to do the same
    4. what else?
  4. Figure out how we're handling video descriptions / transcripts and what work needs to be done there
  5. Figure out what we need to do to get Transifex changed over
  6. Create a branch to work on the changes
    1. Copy (don't move) translation .po / .mo files from zh_CN to zh_HANS 
    2. Copy (don't move) 3rd party translations to zh_HANS? (pdfjs, ...?) and update any config we need to
      1. Potentially upgrade the packages if they've moved over
    3. Make sure static files will get rebuilt appropriately, and with the correct new loc
    4. Update tests to use zh_HANS and start fixing breakages
    5. Write new tests to make sure zh_CN and zh_HANS can co-exist
    6. Update the Transifex config for the new mapping (see Update Settings above)
      1. Note that this is a 1:1 mapping, and pulling future strings from Transifex won't update zh_CN, and may delete it
    7. Do whatever we need to do for video summaries / transcripts *hand wave*
    8. Write and test migration scripts to update mysql and mongo as necessary
    9. Merge
    10. Fix whatever breaks
    11. Remove zh_CN and shims / tests around it
    12. Merge
    13. Fix whatever breaks
    14. Profit

Video Transcripts

Video transcripts are tricky. We have the current video_module xblock and a new version in design right now. In the current code there are HTML5 and Youtube videos. video_module allows a choice of languges that are generated by the list of transcript languages that exist for this video that are included in the LANGUAGES setting. There are also alternative sources for videos, such as CDNs in China, based on user locale. It looks like these actually use the ALL_LANGUAGES setting and have nothing to do with Django translations so they're probably ok. ALL_LANGUAGES already has entries for zh_HANS / zh_HANT.