Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fix missing gettext functions if translations aren't pulled in development environments #34416

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

OmarIthawi
Copy link
Member

@OmarIthawi OmarIthawi commented Mar 23, 2024

Problem

After #34355 LMS and CMS broke due to missing djangojs.js file for English and other languages. The current workaround is to run make pull_translations which is rather inconvenient for development and might not be ran in production builds.

Solution

This is a proposed fix to address the issue in Tutor builds (overhangio/tutor#1024). It works only in development mode and if English is used because atlas pull provides not English translations.

TODO

  • Test locally without pull translations on English
  • Test locally without pull translations on Arabic
Details

image

  • Test locally with pull translations on English
  • Test locally with pull translations on Arabic

Refs

This pull request is part of the FC-0012 project which implements the Translation Infrastructure update OEP-58.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Mar 23, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 23, 2024

Thanks for the pull request, @OmarIthawi! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@OmarIthawi OmarIthawi force-pushed the gettext_fallback branch 2 times, most recently from a8e5501 to b208e97 Compare March 25, 2024 15:46
@brian-smith-tcril brian-smith-tcril changed the title feat: fix missing gettext functions if translations aren't pulled in devstack feat: fix missing gettext functions if translations aren't pulled in development environments Mar 25, 2024
Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick PR @OmarIthawi .

If someone is in development mode and they have pulled translations, will they still be able to see translated pages, or would this PR prevent that? For example, if a developer wants to be sure that their page renders OK using an RTL language, I want to make sure that they can still do that.

@brian-smith-tcril
Copy link
Contributor

If someone is in development mode and they have pulled translations, will they still be able to see translated pages, or would this PR prevent that? For example, if a developer wants to be sure that their page renders OK using an RTL language, I want to make sure that they can still do that.

Based on my understanding of

https://github.com/openedx/edx-platform/blob/b208e971772e40de04b90f9973fb17ac315be568/cms/templates/base.html#L63-L68

I'd think this PR wouldn't prevent that.

It'd probably be best for @OmarIthawi to confirm though

Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, duh :)

 % if LANGUAGE_CODE != 'en': 
   <script type="text/javascript" src="${static.url(jsi18n_path)}"></script> 

@kdmccormick
Copy link
Member

@OmarIthawi @brian-smith-tcril I've been trying to test this locally, but I haven't been able to successfully get my tutor dev site to display any language other than English. Could either of you confirm that the fix works as expected, and also that it still allows one to view the site in other language when they've pulled translations and DEBUG==True? If so, I'm happy to merge this.

@OmarIthawi
Copy link
Member Author

@OmarIthawi @brian-smith-tcril I've been trying to test this locally, but I haven't been able to successfully get my tutor dev site to display any language other than English. Could either of you confirm that the fix works as expected, and also that it still allows one to view the site in other language when they've pulled translations and DEBUG==True? If so, I'm happy to merge this.

@kdmccormick That's a bug. I'll test again locally and move set this pull request as "Ready to merge" again.

@OmarIthawi OmarIthawi marked this pull request as draft March 26, 2024 05:40
@OmarIthawi
Copy link
Member Author

@kylecrawshaw the code now works only for development because atlas pull is a must in production builds.

I've tested it and it works okay on devstack with the Arabic language enabled via DarkLang in Django admin.

Please let me know if you spot any issue in Tutor. This fix should be production-safe and fixes the fresh-Tutor build issue.

@OmarIthawi OmarIthawi marked this pull request as ready for review March 27, 2024 16:14
Copy link
Member

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks @OmarIthawi !

I'll merge this shortly.

@kdmccormick kdmccormick merged commit 5a43777 into openedx:master Mar 27, 2024
67 checks passed
@openedx-webhooks
Copy link

@OmarIthawi 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants