Skip to content

fix: fix issues with LANGUAGE_CODE for legacy UI [BB-4823] [OSPR-6196] - #29180

Merged
jmyatt merged 1 commit into
openedx:masterfrom
open-craft:maxim/bb-4823-fix-issues-with-LANGUAGE-CODE-legacy-UI
Nov 9, 2021
Merged

fix: fix issues with LANGUAGE_CODE for legacy UI [BB-4823] [OSPR-6196]#29180
jmyatt merged 1 commit into
openedx:masterfrom
open-craft:maxim/bb-4823-fix-issues-with-LANGUAGE-CODE-legacy-UI

Conversation

@Cup0fCoffee

@Cup0fCoffee Cup0fCoffee commented Nov 1, 2021

Copy link
Copy Markdown
Contributor

Description

This PR fixes some of the issues of #28502, which are described this comment.

#28502 introduced the change that allows to set LANGUAGE_CODE in site configurations, which made it possible to change translation of the entire site for all learners from Django admin panel. However, the implemented solution didn't work in all cases. This PR implements changes to fix the following:

  • In legacy UI in some instances (most of the times it would be when a language code would be required to format a date) would use the language which was set in users' preferences, or if none were set, would fallback to English

Before (the date is not in the correct format):
Screenshot 2021-10-28 at 00-53-08 لوحة المعلومات Your Platform Name Here
After (the date is now in the correct format):
Screenshot 2021-10-28 at 00-47-41 لوحة المعلومات Your Platform Name Here

Supporting information

BB-4823
OSPR-6196
#28502
#29122

Testing instructions

Deadline

"None"

@openedx-webhooks openedx-webhooks added needs triage open-source-contribution PR author is not from Axim or 2U labels Nov 1, 2021
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @Cup0fCoffee! I've created OSPR-6196 to keep track of it in JIRA, where we prioritize reviews. 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.

@Cup0fCoffee Cup0fCoffee changed the title fix: fix issues with LANGUAGE_CODE for legacy UI [BB-4823] fix: fix issues with LANGUAGE_CODE for legacy UI [BB-4823] [OSPR-6196] Nov 1, 2021
@Cup0fCoffee

Copy link
Copy Markdown
Contributor Author

Doesn't seem like the failing tests are related to the change.

@natabene

natabene commented Nov 1, 2021

Copy link
Copy Markdown
Contributor

@Cup0fCoffee Thank you for your contribution. Please let me know once this is ready for our review.

@0x29a 0x29a left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

  • I tested that dates started showing in Arabic.
  • I read through the code.
  • Includes documentation.

@openedx-webhooks openedx-webhooks added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed needs triage labels Nov 3, 2021
@Cup0fCoffee

Copy link
Copy Markdown
Contributor Author

@natabene The PR is ready for review.

@jmyatt jmyatt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@jmyatt

jmyatt commented Nov 8, 2021

Copy link
Copy Markdown
Contributor

@Cup0fCoffee we'll merge this once the quality check issue is cleared up

When side-wide language is set via LANGUAGE_CODE site configuration,
some elements of legacy UI still use the language set in user
preferences (or None, which fallsback to 'en' if nothing is set in
preferences). The expectation is that everything should be translated to
the language which is set in the site configuration.

In legacy UI (i.e. templates) the code of the current language sometimes
is needed, and in these cases `user_language` variable from the context
is used. The value for that variable is inserted via context processor,
which takes the value from the user preferences.

The solution modifies the context processor to check if there is a
language set in site configuration, and if there is, send that value,
instead of whatever value there was in user peferences.
@Cup0fCoffee
Cup0fCoffee force-pushed the maxim/bb-4823-fix-issues-with-LANGUAGE-CODE-legacy-UI branch from 29514bc to ec1e3b6 Compare November 8, 2021 23:52
@openedx-webhooks openedx-webhooks added ready to merge and removed waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. awaiting prioritization labels Nov 8, 2021
@edx-status-bot

Copy link
Copy Markdown

Your PR has finished running tests. There were no failures.

@Cup0fCoffee

Copy link
Copy Markdown
Contributor Author

@jmyatt Should be good now.

@jmyatt
jmyatt merged commit 25e3247 into openedx:master Nov 9, 2021
@openedx-webhooks

Copy link
Copy Markdown

@Cup0fCoffee 🎉 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
Copy Markdown
Contributor

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

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

1 similar comment
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants