Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
> [: Leonardo F. Fontenelle :] > This might be more to the point: > > for file in po/*.po; do > sed -i "s+msgid \"\([^|]*\)|+msgctxt \"\1\"\nmsgid \"+" $file > done One could also make use of the as-of-yet-unreleased Pology package: $ posieve normctxt-sep -ssep:'|' po/*.po Pology can be obtained and readied for use by: $ svn co svn://anonsvn.kde.org/home/kde/trunk/l10n-support/pology $ export PATH=$PWD/pology/scripts:$PATH The crux of the conversion is in sieve/normctxt_sep.py, method process (line 66). I think it's rather self-explanatory and tuneable for more cleverness (e.g. take into account extracted comments and/or msgstr). The API to message object can be found at pology/doc/html/index.html, module pology.file.message, class Message_base. -- Chusslove Illich (Часлав Илић) pgp7ngj891had.pgp Description: PGP signature ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
Hey Everyone: Thanks much for the conversation around this. Just to follow up, we accomplished this: 1) Came up with a good plan for Python and applied it to accerciser and orca: http://bugzilla.gnome.org/show_bug.cgi?id=569118 http://bugzilla.gnome.org/show_bug.cgi?id=569341 2) Added comments to http://live.gnome.org/GnomeGoals/MsgctxtMigration to help others in the same boat. Will ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
Leonardo F. Fontenelle wrote: Em Ter, 2009-01-27 às 14:09 -0500, Willie Walker escreveu: In the past, I was slapped seriously by the l10n team for touching *.po files. So, I'm requesting permission here before I check in the *.po changes. Is this OK with you all? This might be more to the point: for file in po/*.po; do sed -i "s+msgid \"\([^|]*\)|+msgctxt \"\1\"\nmsgid \"+" $file done BTW, just a quick comment that this doesn't catch mistakes where the translator translated the entire Q_ string rather than translating just the stuff after the "|". Orca's ar.po file, for example, appears to have several cases of this. The second "sed" at http://bugzilla.gnome.org/show_bug.cgi?id=569118#c17 fixes those. Note that the scripts are also making an assumption that the "|" character only shows up in strings for the purposes of the Q_ form. So, if someone has put the "|" character in something other than the Q_ form, the scripts will catch those and split them. As a result, one should carefully examine the files to make sure the expected changes have been made. Will ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
2009/1/27 Willie Walker : > Leonardo F. Fontenelle wrote: >> >> Em Ter, 2009-01-27 às 14:09 -0500, Willie Walker escreveu: >>> >>> In the past, I was slapped seriously by the l10n team for touching *.po >>> files. So, I'm requesting permission here before I check in the *.po >>> changes. Is this OK with you all? >>> >> >> This might be more to the point: >> >> for file in po/*.po; do >>sed -i "s+msgid \"\([^|]*\)|+msgctxt \"\1\"\nmsgid \"+" $file >> done > > Heh. > >> But yes, let's see what happens to nl.po before doing it for every >> file :) > > Comment #23 from the bug > (http://bugzilla.gnome.org/show_bug.cgi?id=569118#c23) > > "Thanks, Willie. This approach to update PO files seems to work quite well. > The nl.po patch looks good, please commit nl.po for me. Thanks again :) > " > > I also separated the *.po diffs into individual files here: > > http://master.gnome.org/~wwalker/569118/ > > This change touches a number of files, so I'd like to get it in sooner than > later so as to avoid needing to keep up with a moving target. > > So, I'll hold off until tomorrow afternoon (US Eastern). If there are great > cries of "NO! NO! NO!", I won't check it in. Otherwise, I'll check it in. > > Will > ___ > gnome-i18n mailing list > gnome-i18n@gnome.org > http://mail.gnome.org/mailman/listinfo/gnome-i18n > The Danish one looks fine. Thanks. Regards Kenneth Nielsen ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
Gabor Kelemen wrote: Willie Walker írta: This change touches a number of files, so I'd like to get it in sooner than later so as to avoid needing to keep up with a moving target. Looks ok for hu.po. Thanks! Only a side note: the lines like #. ONLY TRANSLATE THE PART AFTER THE PIPE CHARACTER | are now unnecessary, please throw them out of the source files. The patch at http://bugzilla.gnome.org/attachment.cgi?id=127348 tosses them already. Thanks! Will ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
Willie Walker írta: This change touches a number of files, so I'd like to get it in sooner than later so as to avoid needing to keep up with a moving target. Looks ok for hu.po. Only a side note: the lines like #. ONLY TRANSLATE THE PART AFTER THE PIPE CHARACTER | are now unnecessary, please throw them out of the source files. Regards Gabor Kelemen ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
Leonardo F. Fontenelle wrote: Em Ter, 2009-01-27 às 14:09 -0500, Willie Walker escreveu: In the past, I was slapped seriously by the l10n team for touching *.po files. So, I'm requesting permission here before I check in the *.po changes. Is this OK with you all? This might be more to the point: for file in po/*.po; do sed -i "s+msgid \"\([^|]*\)|+msgctxt \"\1\"\nmsgid \"+" $file done Heh. But yes, let's see what happens to nl.po before doing it for every file :) Comment #23 from the bug (http://bugzilla.gnome.org/show_bug.cgi?id=569118#c23) "Thanks, Willie. This approach to update PO files seems to work quite well. The nl.po patch looks good, please commit nl.po for me. Thanks again :) " I also separated the *.po diffs into individual files here: http://master.gnome.org/~wwalker/569118/ This change touches a number of files, so I'd like to get it in sooner than later so as to avoid needing to keep up with a moving target. So, I'll hold off until tomorrow afternoon (US Eastern). If there are great cries of "NO! NO! NO!", I won't check it in. Otherwise, I'll check it in. Will ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
Em Ter, 2009-01-27 às 14:09 -0500, Willie Walker escreveu: > In the past, I was slapped seriously by the l10n team for touching *.po > files. So, I'm requesting permission here before I check in the *.po > changes. Is this OK with you all? > This might be more to the point: for file in po/*.po; do sed -i "s+msgid \"\([^|]*\)|+msgctxt \"\1\"\nmsgid \"+" $file done But yes, let's see what happens to nl.po before doing it for every file :) -- Leonardo Fontenelle http://leonardof.org ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
2009-01-27 klockan 20:09 skrev Willie Walker: > In the past, I was slapped seriously by the l10n team for touching *.po > files. So, I'm requesting permission here before I check in the *.po > changes. Is this OK with you all? Hi Willie, Thanks for working on making translators' lifes easier. Could you, as a proof of concept, attach a diff of the "nl.po" file (before and after the conversion) to that bug report, so that I can review it? Thanks. — Wouter signature.asc Description: Digital signature ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
Hey All: We've had some good discussion at http://bugzilla.gnome.org/show_bug.cgi?id=569118 for how to handle Python files. http://bugzilla.gnome.org/show_bug.cgi?id=569118#c9 provides the Python equivalent for C_. http://bugzilla.gnome.org/show_bug.cgi?id=569118#c17 provides a script that hammers through the *.po files to change them from Q_ form to C_ form. I've attached two patches to the bug for Orca - one for the source code and another for the *.po files. It all seems to work fine in my testing between the C locale and the en_GB locale -- I made some temporary mods to the en_GB.po file to make sure I was getting the right string for the right context. In the past, I was slapped seriously by the l10n team for touching *.po files. So, I'm requesting permission here before I check in the *.po changes. Is this OK with you all? Will Willie Walker wrote: Hi All: I'm looking at http://bugzilla.gnome.org/show_bug.cgi?id=569118, which is a request to migrate to C_ from Q_. Doing this in the C programming language seems pretty straightforward, but I'm puzzled about how to do it in Python. The current Orca code does the equivalent of this: def Q_(s): s = _(s) s = s[s.find('|')+1:] return s This was easy to do since we controlled the whole string. Now that a context is explicitly called out with the C_ method, it seems like we might need to make a different gettext method call. I'm not quite sure what to do. Is there a Python precedence that exists that I can take a look at? Will ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
> [: Willie Walker :] > The current Orca code does the equivalent of this: In MO files contexts are separated by U+0004 from the message proper, so I used something equivalent to this in a code I work on: def C_ (c, s): s = _(c + "\x04" + s) p = s.find("\x04") if p >= 0: # satisfied only if no translation found s = s[p + 1:] return s -- Chusslove Illich (Часлав Илић) pgp5eM7keb1WI.pgp Description: PGP signature ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Re: Bug 569118 - Use C_() instead of Q_() with context (orca)
2009-01-26 klockan 13:18 skrev Willie Walker: > I'm looking at http://bugzilla.gnome.org/show_bug.cgi?id=569118, which > is a request to migrate to C_ from Q_. Doing this in the C programming > language seems pretty straightforward, but I'm puzzled about how to do > it in Python. This is not yet officially supported in the Python locale/gettext modules. See http://bugs.python.org/issue2504 for more information. In the mean time, you could just stick to using Q_(), since it's functionally equivalent (but a bit harder for translators to use correctly.) — Wouter signature.asc Description: Digital signature ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n
Bug 569118 - Use C_() instead of Q_() with context (orca)
Hi All: I'm looking at http://bugzilla.gnome.org/show_bug.cgi?id=569118, which is a request to migrate to C_ from Q_. Doing this in the C programming language seems pretty straightforward, but I'm puzzled about how to do it in Python. The current Orca code does the equivalent of this: def Q_(s): s = _(s) s = s[s.find('|')+1:] return s This was easy to do since we controlled the whole string. Now that a context is explicitly called out with the C_ method, it seems like we might need to make a different gettext method call. I'm not quite sure what to do. Is there a Python precedence that exists that I can take a look at? Will ___ gnome-i18n mailing list gnome-i18n@gnome.org http://mail.gnome.org/mailman/listinfo/gnome-i18n