Closed Bug 891835 Opened 11 years ago Closed 11 years ago

l10n comments in templates are not extracted to lang files

Categories

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

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pascalc, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

When using the l10n_merge command, I am not seeing the l10n comments for strings added byt the developper extracted from the templates into the messages.po file (and consecutively the lang files).

Since we use per page lang files, we already give good context for translation to localizers but It would be nice to have them extracted too as additional context information.

Thanks
Could this be due to the comment prefix currently being case-sensitive?  L10n: but not L10N:?  https://bugzilla.mozilla.org/show_bug.cgi?id=868178 is working on fixing that.
Flags: needinfo?(pascalc)
868178 has made the L10n comment prefixes no longer case-sensitive. Can you try again and see if the comments are getting into the .po files now?
So I tried again on master and now I can see comments in the po file:

#. The line break in this headline is presentational. Place the break wherever it seems best for your locale, or omit it if it isn't needed.
#: bedrock/firefox/templates/firefox/os/index.html:102
msgid "Make every <br>moment count"
msgstr ""


But they don't make their way to the corresponding .lang file in the templates folder which is used as a basis for the l10n_merge command:

;Make every <br>moment count
Make every <br>moment count

should be:

# The line break in this headline is presentational. Place the break wherever it seems best for your locale, or omit it if it isn't needed. 
;Make every <br>moment count
Make every <br>moment count

I looked at the code in gettext.py and there is no comment extraction to the lang files, I have a patch that seems to work correctly that extracts those, I will make a pull request and link it to this bug. Feel free to rewrite it if it's not good, I am not a python developer :)
Flags: needinfo?(pascalc)
Comment on attachment 792216 [details]
Pointer to Github pull request: https://github.com/mozilla/bedrock/pull/1178

Pull request:

* gettext.py/pot_to_langfiles() updated to extract comments from pot file to templates/*.lang files
* gettext.py/_append_to_lang_file() now outputs comments if they exist
* dotlang.py/parse() has a new optional parameter: extract_comments=False
* l10n_merge uses extract_comments=True
* updated test_merge_lang_file()
* added test_parse_with_comments()
* all tests pass and my manual testing don't show bugs either
Attachment #792216 - Flags: review?(dpoirier)
Commits pushed to master at https://github.com/mozilla/bedrock

https://github.com/mozilla/bedrock/commit/384982b3455202c6ad76c1b981a4cd5d671562f6
Bug 891835 : extract comments in pot files into lang files

* gettext.py/pot_to_langfiles() updated to extract comments from pot file to templates/*.lang files
* gettext.py/_append_to_lang_file() now outputs comments if they exist
* dotlang.py/parse() has a new optional parameter: extract_comments=False
* l10n_merge uses extract_comments=True
* updated test_merge_lang_file()
* added test_parse_with_comments()
* all tests pass

https://github.com/mozilla/bedrock/commit/fda1ef09a39949743cc5a5678339bea16077c10d
Bug 891835: Improve test coverage of gettext.py module.

https://github.com/mozilla/bedrock/commit/1519fd3d300b02063048ee4af55d27dc512f8ece
Merge pull request #1203 from pmclanahan/extract-comments-lang-files-891835

Bug 891835: extract comments in pot files into lang files
Comment on attachment 792216 [details]
Pointer to Github pull request: https://github.com/mozilla/bedrock/pull/1178

Changes have already been merged, cancelling review request.
Attachment #792216 - Flags: review?(dpoirier)
marking fixed
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: