Closed Bug 652912 Opened 13 years ago Closed 13 years ago

Locale detection is broken, doesn't respect the accepted locales

Categories

(Websites Graveyard :: markup.mozilla.org, defect, P1)

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: stas, Assigned: brez)

References

Details

(Keywords: l12y)

Attachments

(1 file)

I'm not sure how localeurl.middleware.LocaleURLMiddleware works, but it doesn't seem to take into account the accepted locales defined in the LANGUAGES array in https://github.com/mozilla/markup/blob/master/ffdemo/settings.py#L50. 

If I visit the staging site with the following locale prefs: (pl, fr), I see English, and I should see French (French is the first accepted locales on the list.)
Assignee: nobody → adam
Severity: normal → major
Priority: -- → P1
Target Milestone: --- → 1.0
Assignee: adam → jbresnik
I don't understand - are the translations done?  If not, you will only ever see English
Stas - assign this to you so you can answer...
Assignee: jbresnik → stas
I checked out http://svn.mozilla.org/projects/l10n-misc/trunk/markup/locale/ into a local directory

ffdemo/locale

I edited the es django.po
I added es to the list of supported locales in settings.py
I restarted my server.

I didn't see the Spanish strings :(
Right now, independent of my browser's language preferences, I'm always served en-US on the staging server.

(Back when I filed this bug, the locale detection would only look on the first language in my preferences, and if it wasn't on the supported locales list in settings, it would fall back to en-US, instead of looking at my second preference, third, and so on.)
Assignee: stas → jbresnik
Blocks: 654862
Just to clarify a part of a test plan...

Locale detection Use Case
1) Switch primary language of Firefox 4 to French
2) http://209.20.77.205/

Actual
Redirected to http://209.20.77.205/en-US/#/

Expected
Redirected to http://209.20.77.205/fr/#/
By adding tower, jingo, commons/middleware.py etc i've got the fr redirect working locally for the homepage.

Cursory testing, this breaks mark submission, so I'm digging into why.
This should work now. I've added our usual middleware as well as jingo.

fr redirection works.
I've tested with fake Spanish strings, and gettext is working.

https://github.com/mozilla/markup/commit/120e63cd0cb5a408d2ac502596e83ef5d637d33b

https://github.com/mozilla/markup-lib/commit/9b6096ac13ffbad4febad825f10104c342b4b28c
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Not seeing the fix on stage. Troubleshooting in Bug#655271
Comment on attachment 530471 [details] [diff] [review]
Adding commons, tower, etc

Review of attachment 530471 [details] [diff] [review]:
-----------------------------------------------------------------

::: ffdemo/settings.py
@@ +61,5 @@
>          from product_details import product_details
> +        return dict([(lang.lower(), product_details.languages[lang]['native'])
> +                     for lang in KNOWN_LANGUAGES])
> +
> +LANGUAGES = lazy(LazyLangs, dict)()

Any specific reason why you changed the tuple to a dict?  I think this broke the lang switcher in the footer.
I filed bug 655305 to address comment 9.

Otherwise, the locale detection works very well now.  Thanks a ton, Austin!
This data structure is required by our middleware.
I'll look at updating the lang drop down.
Filed another follow-up: bug 655875.
This works as expected now, thanks Austin.
Status: RESOLVED → VERIFIED
Product: Websites → Websites Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: