Closed Bug 656681 Opened 13 years ago Closed 6 years ago

Tower activates by locale, Django activates by language

Categories

(support.mozilla.org :: Code Quality, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: andy+bugzilla, Unassigned)

References

Details

SUMO for Thunderbird exposed an issue in tower. So maybe this should be refiled under tower. On the first request per thread, SUMO was not showing the correct en_US translation. Subsequent requests are. 

Short answer: I'd like to change tower to activate by language, mirroring Django.

Long answer: on startup

- Django creates a translation with the key en-us using Django i18n. The language for that translation is en-us.

- middleware activates the translation with the key en_US in Tower (by locale). The language for that translation is en-us. 

- SUMO in urls.py pulls in models:

https://github.com/jsocol/kitsune/blob/master/apps/questions/urls.py#L42

- those models store the current translations language (en-us). They deactivate all translations and then reactivate the translation, by language using Django's i18n. That means the en-us translation is now active.

https://github.com/django/django/blob/master/django/db/models/options.py#L194

- this means the incorrect translation is shown.

- subsequent requests the translation set back to en-US.

A quick fix is:

https://gist.github.com/967889

A longer fix is to make tower and django use the same key language, as opposed to locale.
So, what is the use case that has the problem?  I mean, the reasoning sounds fine and everything, but why haven't we seen this before now?
SUMO for Thunderbird have localised en-US, basically replacing Firefox with Thunderbird where appropriate. Further it only occurs when the order of translation activation means that tower activation happens before Django. 

Since AMO, for example, has not localised en-US and has a different translation activation order, you don't see it there.
(In reply to comment #2)
> SUMO for Thunderbird have localised en-US, basically replacing Firefox with
> Thunderbird where appropriate. 
 
I'm looking at http://svn.mozilla.org/projects/sumo/locales/ but I still don't know what that means. :)  It sounds like it's breaking the spec somewhere though. ;)
Our translations are here, fyi: http://svn.mozilla.org/mozillamessaging.com/sites/kitsune-sumomo/trunk/locales/

I still think this is a bug even if you're not localizing en-US, though -- we merely exposed it. Swapping being translations based on locale and language such that you end up with the wrong translation or msgids being shown seems like a bug to me whether or not it's triggered on most sites.
(In reply to comment #3)
> It sounds like it's breaking the spec
> somewhere though. ;)

It's just msgid!=msgstr for SuMoMo in English. Something [I believe you're familiar with](http://micropipes.com/blog/2007/07/26/ten-tips-for-website-localization/). ;)
Assignee: nobody → amckay
Assignee: amckay → nobody
Kitsune switched from Tower to Puente, so this is moot now. Marking as WONTFIX.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.