Translation bar: request doesn't disappear after switching language

VERIFIED FIXED

Status

VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: flod, Assigned: kohei)

Tracking

Details

(Whiteboard: [kb=1219847])

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
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).
(Reporter)

Comment 1

5 years ago
I'm seeing this on OS 10.9, Firefox 29.0a1 (2013-12-11)
I can't reproduce with Firefox 26 on Linux
(Reporter)

Updated

5 years ago
Summary: Translation bar: request should disappear after switching language → Translation bar: request doesn't disappear after switching language
(Reporter)

Comment 3

5 years ago
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
(Assignee)

Comment 4

5 years ago
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 ;)

Comment 7

5 years ago
FYI, This also affects Turkish.
(Assignee)

Comment 8

5 years ago
Will take a look along with Bug 949828.
(Assignee)

Updated

5 years ago
Duplicate of this bug: 949828
(Assignee)

Comment 10

5 years ago
Created attachment 8349524 [details] [review]
Pull Request on GitHub

Thanks guys, I just sent a PR to fix the issue.
(Assignee)

Updated

5 years ago
Whiteboard: [kb=1219847]

Comment 11

5 years ago
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

Updated

5 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED

Comment 12

5 years ago
Should the fix be live at this point? Because it still doesn't work for Turkish.
(Reporter)

Comment 13

5 years ago
It should be visible on www-dev.allizom.org in 15 minutes, still need to be pushed to prod (I guess later today).
(Assignee)

Comment 14

5 years ago
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)
(Reporter)

Comment 15

5 years ago
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)
(Assignee)

Comment 16

5 years ago
(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">

Comment 17

5 years ago
It seems to be working. Thanks!
Flags: needinfo?(selim)
(Assignee)

Comment 18

5 years ago
Great, thanks!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.