All users were logged out of Bugzilla on October 13th, 2018

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

RESOLVED FIXED

Status

P2
normal
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Milos, Assigned: pmac)

Tracking

(Blocks: 2 bugs)

Firefox Tracking Flags

(Not tracked)

Details

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

(Reporter)

Description

6 years ago
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.

Updated

6 years ago
Blocks: 775269
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

Updated

6 years ago
Whiteboard: u=localizer c=l10n p=2 [sb-sprint]

Updated

6 years ago
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

Updated

6 years ago
Component: L10N → Bedrock

Updated

6 years ago
Assignee: nobody → pmac

Comment 3

6 years ago
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.

Updated

6 years ago
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

Updated

6 years ago
Component: L10N → Bedrock

Comment 7

6 years ago
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.

Updated

6 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED

Comment 8

6 years ago
Commit pushed to master at https://github.com/mozilla/bedrock

https://github.com/mozilla/bedrock/commit/c6240235249f956dc2070eb3257b91cc1169f690
Use SkipTest from nose as skip is only in Py 2.7+.

bug 783202.
awesome, thanks pmac ! :)
You need to log in before you can comment on or make changes to this bug.