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

Fix part of #3550: Move translation check from footer to header #4738

Merged
merged 6 commits into from
Feb 27, 2018

Conversation

tjiang11
Copy link
Contributor

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

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes.
  • The PR explanation includes the words "Fixes #bugnum: ...".
  • The linter/Karma presubmit checks have passed.
    • These should run automatically, but if not, you can manually trigger them locally using python scripts/pre_commit_linter.py and bash scripts/run_frontend_tests.sh.
  • The PR is made from a branch that's not called "develop".
  • The PR follows the style guide.
  • The PR is assigned to an appropriate reviewer.
    • If you're a new contributor, please ask on Gitter for someone to assign a reviewer.
    • If you're not sure who the appropriate reviewer is, please assign to the issue's "owner" -- see the "talk-to" label on the issue.

@tjiang11 tjiang11 requested a review from kevintab95 February 24, 2018 21:32
@tjiang11
Copy link
Contributor Author

#3550

Copy link
Member

@seanlip seanlip left a 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,
Copy link
Member

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-io
Copy link

codecov-io commented Feb 25, 2018

Codecov Report

Merging #4738 into develop will increase coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ
core/templates/dev/head/i18n.js 47.82% <ø> (+3.82%) ⬆️
...ts/top_navigation_bar/TopNavigationBarDirective.js 1.04% <0%> (-0.03%) ⬇️
core/templates/dev/head/directives.js 22.05% <0%> (-0.33%) ⬇️
.../head/components/forms/Select2DropdownDirective.js 3.03% <0%> (-0.1%) ⬇️
...ns/PencilCodeEditor/directives/PencilCodeEditor.js 32.32% <0%> (ø) ⬆️
.../dev/head/components/forms/AudioPlayerDirective.js 14.28% <0%> (ø)
...re/templates/dev/head/services/RteHelperService.js 84.41% <0%> (+0.41%) ⬆️
core/templates/dev/head/filters.js 70.3% <0%> (+1.5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c3e9a24...fd56286. Read the comment docs.

@seanlip
Copy link
Member

seanlip commented Feb 25, 2018

(Btw, confirming LGTM apart from the one outstanding comment. Please feel free to merge after that's resolved!)

@tjiang11 tjiang11 merged commit b2f102f into oppia:develop Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants