Closed Bug 1167192 Opened 9 years ago Closed 9 years ago

remove tower

Categories

(Input :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: willkg, Assigned: rrosario)

References

Details

(Whiteboard: u=dev c=codequality p= s=input.2015q2)

Tower is used to extract and merge strings into .pot files for localization. It's a pretty critical part of the development infrastructure for Input.

Tower pulls the strings by parsing template files and a bunch of other files.

This bug covers looking into whether tower will work with django 1.8. Particularly:

1. We're thinking about switching to django-jinja. Will Tower work with django-jinja?

2. Are there any changes required to Tower to make Tower work with Django 1.8 and django-jinja? If so, we should make them.

3. What configuration changes are required to make it work?


We have a few caveats:

1. We need to make absolutely sure that msgids don't change.

2. We need to make sure we don't lose strings from the .pot file or pick up strings that shouldn't be in the .pot file.
Assigning this to Ricky.
Assignee: nobody → rrosario
I talked with Mike Kelly and Giorgos about this:

https://github.com/mozilla/sugardough/issues/73

Given that l10n doesn't care and there are sites already that are getting translated that don't use tower, I vote we ditch tower.

So at that point, we need to figure out how to migrate from tower to non-tower. I'm not sure what that entails. I think the tricky issues are these:

1. gettext/ngettext having msgctxt -- we have to convert the code to use pgettext, pgettext_lazy, npgettext and npgettext_lazy and see if there are other places we add context that's not getting pulled out (frankly, I think I like the L10N: comments better)

2. *gettext* collapsing white space on msgids to match strings

3. extracting strings collapses whitespace

4. we use "messages.pot" instead of "django.pot"
I forgot--there's another player in the mix: Babel. Input currently uses Tower which uses Babel. In the Tower issues is this:

https://github.com/clouserw/tower/issues/29

That's related to item 1.
This is important--making it a P2.
Priority: -- → P2
Status: NEW → ASSIGNED
Willkg and I just had an epic vidyo session. Here is the plan:

Plan:

1. Go through and replace all tower ugettext/ugettext_lazy with django equivalents.
   Should be easy and not a big deal. Make sure msgids dont' change!

2. [research] We also need to change the locale svn repository and rename all
   messages.po* to django.po*. Do we have to do something in Verbatim, too?
   
   Once we figure that out, we can work on 3.

3. Create tower-lite which has extract/makemessages and i18n extension but works on
   django.pot and djangojs.pot files.

For 2 and 3, we'll want to make all the svn changes and then deploy the code. They
have to happen in that order otherwise we'll have everything in English.
> 1. Go through and replace all tower ugettext/ugettext_lazy with django
> equivalents.
>    Should be easy and not a big deal. Make sure msgids dont' change!

PR for this part is here:
https://github.com/mozilla/fjord/pull/596
> 2. [research] We also need to change the locale svn repository and rename all
>    messages.po* to django.po*. Do we have to do something in Verbatim, too?

Filed bug 1173479 with the L10n/Verbatim team
Depends on: 1173479
> 3. Create tower-lite which has extract/makemessages and i18n extension but
> works on
>    django.pot and djangojs.pot files.

Another thing that we use tower for is to activate the locale. We'll need to see if we can just use django's activation or if there is something else that tower does that we might need.
Ricky moved the jinja2 InternationalizationExtension override tower had into fjord.

PR: https://github.com/mozilla/fjord/pull/607

Landed in: https://github.com/mozilla/fjord/commit/7e8af1be43b4c73513f4091b5cefa43c0f263868
Switching this bug from a research bug to a "remove tower" bug since that's what we're doing now.
Summary: [research] look into tower and django 1.8 → remove tower
Moving the extract/merge commands to fjord and nixing tower work done in PR: https://github.com/mozilla/fjord/pull/608

Landed in: https://github.com/mozilla/fjord/commit/ac406e4ecbe4176faff3c618055d286059a47afe
Pushed this to prod just now. Goodbye tower!
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.