Closed Bug 783202 Opened 12 years ago Closed 12 years ago

Make l10n_utils.dotlang._ able to extract strings to specific file

Categories

(www.mozilla.org :: Bedrock, defect, P2)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Milos, Assigned: pmac)

References

(Blocks 1 open bug)

Details

(Whiteboard: u=localizer c=l10n p=2)

Currently, our l10n_utils.dotlang._ method extract strings straight into main.lang files. We'd need that method to accept another parameter to pick which .lang file we want the string to be extracted to.
To make the request clearer, we can define in a template which .lang file to use for a page, for example {% add_lang_files "whatsnew" %}. But there are strings that are not part of a template because they are not in a pure web context (email strings for example), and then bedrock falls back to main.lang which is not what we want.
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
ok, this bug is actually impacting our work on the contribute page, we are currently targetting a few locales until we feel confortable going large scale (that means having a native speaker per locale volunteering to manage incoming form requests, so that will be gradual) and currently the strings for the contact form are extracted into main.lang shared by all locales, sending the signal to localizers that we are ready to have that page in 90 languages, which I don't think is realistic as of today :). CCing Ben, Ben could we put this bug into the next sprint? Thanks
Blocks: 755351
Whiteboard: u=localizer c=l10n p=2 [sb-sprint]
Component: General → L10N
Summary: [bedrock] Make l10n_utils.dotlang._ able to extract strings to specific file → Make l10n_utils.dotlang._ able to extract strings to specific file
Component: L10N → Bedrock
Assignee: nobody → pmac
testing
Priority: -- → P2
Would you want to specify this per call to `_()`, or would it be better to be able to specify per python file, like with a function call `set_lang_file('blah')` at the top of the file?
ideally both ? ;) But setting that at the top of a python file would already be a great step forward.
Whiteboard: u=localizer c=l10n p=2 [sb-sprint] → u=localizer c=l10n p=2
Submitted https://github.com/mozilla/bedrock/pull/394 This adds the ability to add a `LANG_FILES` constant to python files that will work like the `add_lang_files` tag in templates. The value can be a single name (e.g. 'firefoxos') or a list of strings (e.g. ['firefoxos', 'b2g']). The docs are updated with more info. It turned out that adding an extra argument to the `_` function was impossible without patching multiple external libraries. I think this works better anyway.
Status: NEW → ASSIGNED
Blocks: 797984
Component: Bedrock → L10N
Component: L10N → Bedrock
Commit pushed to master at https://github.com/mozilla/bedrock https://github.com/mozilla/bedrock/commit/e3a5eae6250215eed0e1a92fb0aa380a19106010 Add ability to specify lang files in python src. * Fix bug 783202. * Update docs.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
awesome, thanks pmac ! :)
You need to log in before you can comment on or make changes to this bug.