Merge lp:~jtv/launchpad/bug-662552-suggestive-potemplates into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Jeroen T. Vermeulen |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11800 |
Proposed branch: | lp:~jtv/launchpad/bug-662552-suggestive-potemplates |
Merge into: | lp:launchpad |
Diff against target: |
335 lines (+91/-20) 11 files modified
lib/lp/translations/doc/potmsgset.txt (+17/-1) lib/lp/translations/model/potmsgset.py (+4/-17) lib/lp/translations/stories/standalone/xx-pofile-translate-alternative-language.txt (+8/-0) lib/lp/translations/stories/standalone/xx-pofile-translate-dismiss-suggestions.txt (+10/-0) lib/lp/translations/stories/standalone/xx-pofile-translate-legal-warning.txt (+8/-0) lib/lp/translations/stories/standalone/xx-pofile-translate.txt (+8/-2) lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt (+10/-0) lib/lp/translations/stories/translationgroups/60-translation-suggestions.txt (+5/-0) lib/lp/translations/tests/test_potmsgset.py (+7/-0) lib/lp/translations/tests/test_suggestions.py (+6/-0) lib/lp/translations/tests/test_translatablemessage.py (+8/-0) |
To merge this branch: | bzr merge lp:~jtv/launchpad/bug-662552-suggestive-potemplates |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | code | Approve | |
Review via email: mp+39354@code.launchpad.net |
Commit message
Use suggestive-
Description of the change
= Bug 662552 =
Translations has been getting a lot of timeouts lately. The page that probably makes users suffer most is POFile:+translate, which is slow mainly because it collects and displays "global suggestions." These are translations that have been entered or used for a given English string elsewhere in Launchpad. They're one of those features that make Launchpad Translations so useful.
Part of the work when gathering global suggestions is to find matching English strings and their translations. Another part is finding out whether their templates belong to projects or distributions that officially use Launchpad for translations, and whether they occur in enabled templates.
This second part is done identically several times for each message on a translation page, and does not change between page requests.
So I did the obvious, some time ago: create a little cache table that lists the templates that qualify as sources for global suggestions. This is the "suggestive templates cache." The cache is present and kept up to date on production, but not used yet. This branch changes that, simplifying the global-suggestions query to a narrower join with less sensitivity to locks. (And an XXX disappears in the process).
Most of the diff deals with tests that are affected by the extra caching. Generally all that's needed is to initialize the cache at the beginning of the test; I didn't want to add more sample data here that needs to be kept consistent and restored after every test.
The best way to test this is to run all Translations tests:
{{{
./bin/test -vvc lp.translations
}}}
To Q/A, check that the translation pages still show global suggestions, i.e. suggestions that are not directly related to the context that you're translating. For instance, until we land the Recife feature branch, suggestions made (but not used) in Ubuntu packages show up in their upstream projects only because of global suggestions.
When doing Q/A, it's important to ensure that the server's configuration has been updated to re-enable global suggestions. Oops levels should end up below what they were on 2010-10-26, and preferably less even than that. The easiest thing to observe is probably the difference in page timings between staging and production.
There's a bit of lint left, though none that I would seem to have caused. I'd be happy to clean it up during or after review. For now I did not want to pollute the diff.
Jeroen