Bug 794059. Allow pages to be activated per locale.#459
Conversation
There was a problem hiding this comment.
Not sure if this should get some caching or not. It should be pretty quick to check the first line of a file, but if you guys think that storing the results in memcache for a minute or so might help with load then it can be easily added.
There was a problem hiding this comment.
IMO it's worth given how easy this would be to cache, although I'm curious why you'd only cache it for a minute. How often do these files change on production? Is memcache cleared when we push?
There was a problem hiding this comment.
That was based on the value in our settings for DOTLANG_CACHE being 60. I think we should consider increasing that as well to at least the length of time between the cron runs.
|
Note: This PR should not be merged before making sure the appropriate .lang files have been updated with the |
|
Agreed. @rik any thoughts on the performance implications? |
|
I'll let others review this :) |
lib/l10n_utils/dotlang.py
Outdated
There was a problem hiding this comment.
There's a possible race condition between here and when you actually open the file below. You should probably use a try clause instead and catch the IOError
There was a problem hiding this comment.
Yeah, but only if the file doesn't exist right? So we might get one more false negative before we see the locale activated. This doesn't seem like a big enough deal to worry with. This should almost never happen anyway as these files are automatically created.
Fix bug 794059.
|
@Osmose updated for your approval. |
|
Looks good, although some tests for the cache logic would be nice. :D r+ |
|
FYI, The .lang files for python templates are all updated with the ## active ## tag |
Going to a page at a non en-US locale will now redirect
to en-US unless the corresponding .lang file for that
template and locale has
## active ##as its firstline. This will allow localizers to only publish a
localized page after it's confirmed to be fully and
correctly translated.