Change localization to use English strings as msgid's (for gettext)



10 years ago
8 years ago


(Reporter: stas, Assigned: stas)





(3 attachments)



10 years ago
Created attachment 377229 [details] [diff] [review]
Use English strings inside gettext's _() function
Attachment #377229 - Flags: review?(ozten.bugs)

Comment 1

10 years ago
Created attachment 377231 [details]
New messages.po

After applying the patch from comment #0, you can run web/applications/locale/ as many times you want, and it will give you a PO file like this one.
This looks really good, thanks for your help!

Some questions:
I had put comments into the previous messages.po, to explain what %1$s was, etc. How do I do this now?
Once I change some copy and rerun extra, I see that I have two strings (old and new).

Running the process in the README.txt, this merges into other locales. The locale get's a new string that hasn't been translated.

Is this the processes for updates down the road?
Should I manually delete the old string before merging?
Do I need to manually delete the old string from all the locale po files?
Comment on attachment 377229 [details] [diff] [review]
Use English strings inside gettext's _() function

Please commit your patch! Thanks for the great work. I'll have some follow up questions, so I understand the tooling around this processes.
Attachment #377229 - Flags: review?(ozten.bugs) → review+

Comment 5

10 years ago
Patch from comment #0 committed in r25675.

I'm trying to figure out how to add comments to the PO file automatically, thus leaving the bug open.

Comment 6

10 years ago
Created attachment 377312 [details] [diff] [review]
Example of how to add comments

OK, got it. Adding comments is easy. You'll just have to modify the script to use the "--add-comments" option to xgettext. Then, gettext will automatically pick up any PHP comments preceding _() function calls.

I attach a working example of such a comment for one of the strings.

If there are other, non-l10n-related comments in the PHP that shouldn't be picked up by gettext, you can use for example "--add-comments=L10N" in and then begin each l10n-comment with "L10N".

Comment 7

10 years ago
Patch landed (see comment 5), stage displays correctly English strings instead of ids and I chatted with Austin on IRC about the next steps and preparing the PO files for localization with msginit, as well as updating them if necessary with msgmerge.

Can we close this bug now?
Assignee: nobody → stas
Stas great work. Closing bug.
Last Resolved: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.0
Verified FIXED.


8 years ago
Component: →
Product: Websites → Websites Graveyard
You need to log in before you can comment on or make changes to this bug.