fix: fix issues with LANGUAGE_CODE for legacy UI [BB-4823] [OSPR-6196] - #29180
Conversation
|
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:
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. |
|
Doesn't seem like the failing tests are related to the change. |
|
@Cup0fCoffee Thank you for your contribution. Please let me know once this is ready for our review. |
|
@natabene The PR is ready for review. |
|
@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.
29514bc to
ec1e3b6
Compare
|
Your PR has finished running tests. There were no failures. |
|
@jmyatt Should be good now. |
|
@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 Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
1 similar comment
|
EdX Release Notice: This PR has been deployed to the production environment. |
Description
This PR fixes some of the issues of #28502, which are described this comment.
#28502 introduced the change that allows to set
LANGUAGE_CODEin 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:Before (the date is not in the correct format):


After (the date is now in the correct format):
Supporting information
BB-4823
OSPR-6196
#28502
#29122
Testing instructions
LANGUAGE_CODEsite config toarat http://localhost:18000/admin/site_configuration/siteconfiguration/ (it might take some time to take effect because of caching; you can addSITE_CACHE_TTL = 0tolms/envs/private.pyto remove caching)Deadline
"None"