Closed Bug 949143 Opened 7 years ago Closed 7 years ago

Translation bar: request doesn't disappear after switching language

Categories

(Websites :: Tabzilla, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: flod, Assigned: kohei.yoshino)

References

Details

(Whiteboard: [kb=1219847])

Attachments

(1 file)

44 bytes, text/x-github-pull-request
Details | Review
Test case.

1) Open mozilla.org/de with a browser set to a different language (in my case Italian).
2) Say yes to the request of displaying the page in Italian.
3) The translation bar still shows asking if I want to display the page in Italian (but it's already in Italian).
I'm seeing this on OS 10.9, Firefox 29.0a1 (2013-12-11)
I can't reproduce with Firefox 26 on Linux
Summary: Translation bar: request should disappear after switching language → Translation bar: request doesn't disappear after switching language
Found the culprit

Default value, translation bar doesn't work as expected
intl.accept_languages = it-IT, it, en-US, en

With these settings it disappears
intl.accept_languages = it,it-it,en-us,en
I think I have added a code to deal with such a case (eg. it vs it-IT, fr vs fr-FR, etc.) but anyway let me check.
Assignee: nobody → kohei.yoshino
Status: NEW → ASSIGNED
locally, if I move this block at line 354:
https://github.com/mozilla/bedrock/blob/master/bedrock/tabzilla/templates/tabzilla/tabzilla.js#L354

if (!userLang || !pageLang ||
        userLang.toLowerCase() === pageLang.toLowerCase()) {
    console.log('boo');
    return;
}

after line https://github.com/mozilla/bedrock/blob/master/bedrock/tabzilla/templates/tabzilla/tabzilla.js#L387

that is to say, after the final normalization of the language code, it works for me.
discar the console.log() part above, that was part of my testing ;)
FYI, This also affects Turkish.
Will take a look along with Bug 949828.
Duplicate of this bug: 949828
Attached file Pull Request on GitHub
Thanks guys, I just sent a PR to fix the issue.
Whiteboard: [kb=1219847]
Commits pushed to master at https://github.com/mozilla/bedrock

https://github.com/mozilla/bedrock/commit/ca890a88b362a2e73ec5e06da2637b33f54557b5
Fix Bug 949143 - Translation bar: request doesn't disappear after switching language

https://github.com/mozilla/bedrock/commit/940cd70173ae452a0573d40019e741814ba6f417
Merge pull request #1537 from kyoshino/bug-949143-transbar-legacy

Fix Bug 949143 - Translation bar: request doesn't disappear after switching language
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Should the fix be live at this point? Because it still doesn't work for Turkish.
It should be visible on www-dev.allizom.org in 15 minutes, still need to be pushed to prod (I guess later today).
Selim: can you verify the fix on https://www-dev.allizom.org/tr/

Now the Translation Bar should be hidden even if your navigator.language (the intl.accept_languages preference in Firefox) is tr-TR instead of tr.

The fix should also work with other obsolete ab-CD style navigator.language like fr-FR, it-IT, el-GR or ja-JP.
Flags: needinfo?(selim)
Works for me on https://www-dev.allizom.org/it/ (bar doesn't appear).

Funny thing is if I open https://www-dev.allizom.org/tr/ and choose YES to display the page in Italian, I get redirect to prod (https://www.mozilla.org/it)
(In reply to Francesco Lodolo [:flod] from comment #15)
> Funny thing is if I open https://www-dev.allizom.org/tr/ and choose YES to
> display the page in Italian, I get redirect to prod
> (https://www.mozilla.org/it)

Yes, because the destination is based on the alternate URL:
<link rel="alternate" hreflang="it" href="http://www.mozilla.org/it/" title="Italiano">
It seems to be working. Thanks!
Flags: needinfo?(selim)
Great, thanks!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.