overhangio / tutor

The Docker-based Open edX distribution designed for peace of mind
https://docs.tutor.overhang.io/
GNU Affero General Public License v3.0
936 stars 443 forks source link

Extend allowed language codes #1123

Open RonanFR opened 2 months ago

RonanFR commented 2 months ago

Is your feature request related to a problem? Please describe. Problem described here: https://discuss.openedx.org/t/translations-issue-in-redwood-tutor-18/13953/3 Currently most of the French translations need a review on transifex and that's why almost nothing is translated to French when setting the language code to fr. @OmarIthawi suggested to use French Canadian (which is fully reviewed) until French get reviewed. However, when answering fr_CA or fr-ca or fr_ca to the question The default language code for the platform [en] in the interactive platform configuration (tutor local launch) I get the error: Error: 'fr-ca' is not one of 'en', 'am', 'ar', 'az', 'bg-bg', 'bn-bd', 'bn-in', 'bs', 'ca', 'ca@valencia', 'cs', 'cy', 'da', 'de-de', 'el', 'en-uk', 'en@lolcat', 'en@pirate', 'es-419', 'es-ar', 'es-ec', 'es-es', 'es-mx', 'es-pe', 'et-ee', 'eu-es', 'fa', 'fa-ir', 'fi-fi', 'fil', 'fr', 'gl', 'gu', 'he', 'hi', 'hr', 'hu', 'hy-am', 'id', 'it-it', 'ja-jp', 'kk-kz', 'km-kh', 'kn', 'ko-kr', 'lt-lt', 'ml', 'mn', 'mr', 'ms', 'nb', 'ne', 'nl-nl', 'or', 'pl', 'pt-br', 'pt-pt', 'ro', 'ru', 'si', 'sk', 'sl', 'sq', 'sr', 'sv', 'sw-ke', 'ta', 'te', 'th', 'tr-tr', 'uk', 'ur', 'vi', 'uz', 'zh-cn', 'zh-hk', 'zh-tw'.

Describe the solution you'd like Would it be possible to extend the list of available language codes ? (using all those available on transifex) I have identified that the list is defined here: https://github.com/overhangio/tutor/blob/2959e6eec230c72d10417f886179a1878cdd7143/tutor/interactive.py#L66 However, I haven't tried to manually set the variable LANGUAGE_CODE to fr_CA in the config.yml file to see if it works (it is not clear to me yet where and how the variable is used to pull translations from atlas). So I don't know if additional modifications are needed (or if adding fr_CA to the above list is sufficient).

regisb commented 2 months ago

A related issue was discussed here, about Latvian: https://discuss.openedx.org/t/open-edx-localization/13832

  1. As a temporary fix, you may run tutor config save --set LANGUAGE_CODE=fr_CA. But you won't be able to run tutor local launch in interactive mode anymore.
  2. As a slightly less temporary fix, we can add "fr_CA" to the list of accepted language codes.
  3. As a more acceptable fix, we should make the list of language code extensible by any plugin developers. To do that, we should create and use a tutor.hooks.Filters.OPENEDX_LANGUAGE_CODES filter.
  4. As a definitely-most-betst fix, edx-platform should accept all languages in LANGUAGES. It makes zero sense to keep overriding that setting like we do in edx-platform. See the discussion that I linked to above.
  5. As a complementary, very important fix, the language strings for "fr" should be reviewed ASAP. Obviously I'm biased but come on: we hosted the Olympics, we won two Football world cups, surely we deserve to have one reviewed locale, right? (In all seriousness I find it very disturbing that Redwood was released without the "fr" locale)
RonanFR commented 2 months ago

@regisb Thanks for your quick reply !

To your 5th point: Haha yes I was also surprised ! I asked to be a translator on transifex to contribute to the reviews (request pending).

OmarIthawi commented 2 months ago

On a related note, Open edX makes it hard to configure the languages. We have many places for the same setting.

I imagine a centralized place to configure the following:

In Tutor, we can only easily change LANGUAGE_CODE, LANGUAGES and Account Settings language list cannot be changed.