-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix part of #3550: Move translation check from footer to header #4738
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks @tjiang11. Might want to leave a comment in the original issue with your findings, for reference.
'SidebarStatusService', 'LABEL_FOR_CLEARING_FOCUS', | ||
'siteAnalyticsService', 'WindowDimensionsService', 'DebouncerService', | ||
function( | ||
$scope, $http, $window, $timeout, | ||
$scope, $http, $window, $timeout, $translate, $cookies, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why import $cookies at all?
Codecov Report
@@ Coverage Diff @@
## develop #4738 +/- ##
===========================================
+ Coverage 44.66% 44.68% +0.02%
===========================================
Files 384 385 +1
Lines 23435 23462 +27
Branches 3799 3802 +3
===========================================
+ Hits 10467 10485 +18
- Misses 12968 12977 +9
Continue to review full report at Codecov.
|
(Btw, confirming LGTM apart from the one outstanding comment. Please feel free to merge after that's resolved!) |
Fix part of 3550
Explanation
After many attempts, I could not figure out why the learner views, creator views, and collection view have duplicate NG_TRANSLATE_LANG_KEY cookies. I believe it has something to do with the path. One interesting observation is that if you console.log the cookie inside the top nav directive, and then console.log cookie after a timeout of 100ms, you see that the duplicate cookie is being set from somewhere else, but I just can't find where this happens.
I find that when I try to remove the cookies manually before doing the translation check, this actually makes the exploration view, collection view translations work properly, but this breaks the library, about, donate, etc. pages. One dirty fix would be to specify when to manually remove the duplicate cookie on each page, but it would be much better to find the root cause.
Anyways, this PR moves the translation check from the footer to the header, as the header is on every page whereas the footer isn't. As such, pages without a footer weren't capturing the language changes. The problem should now be localized to the case when a guest changes from the library to collection or exploration view.
Checklist
python scripts/pre_commit_linter.py
andbash scripts/run_frontend_tests.sh
.