[Kbabel] Fwd: gettext and contexts
Chusslove Illich
caslav.ilic at gmx.net
Thu Oct 20 20:26:40 CEST 2005
This is probably because, following Nicolas' message, I asked Bruno when
the new Gettext would be released :)
---------- Прослеђена порука ----------
Subject: gettext and contexts
Date: четвртак 20. октобар 2005. 20.08
From: Bruno Haible <bruno at clisp.org>
To: Thomas Diehl <thd at kde.org>
Cc: Chusslove Illich <caslav.ilic at gmx.net>, Stanislav Visnovsky
<visnovsky at kde.org>
Hi,
The following feature has been added in GNU gettext.
* GUI program support:
- PO files can now contain messages constrained to a certain context.
Most often such a context is a menu, dialog or panel identification.
The syntax in the PO file is
msgctxt "context"
msgid "original"
msgstr "translation"
- The xgettext program can be told through the --keyword flag which
function/macro argument has the role of a context.
- The (non-public) include file gettext.h defines macros pgettext,
dpgettext
etc. that take a context argument.
For more information, see the node "Contexts" in the manual.
xgettext can now distinguish the uses of KDE's i18n function according
to the number of arguments:
// (KDE) The 1-argument i18n macro is a simple gettext without context.
print (i18n ("help"));
// (KDE) The 2-argument i18n macro has the context first.
print (i18n ("Help", "about"));
// (KDE) The 3-argument i18n macro is an ngettext without context.
print (i18n ("error", "errors", 7));
yields
-----------------------
msgid "help"
msgstr ""
msgctxt "Help"
msgid "about"
msgstr ""
msgid "error"
msgid_plural "errors"
msgstr[0] ""
msgstr[1] ""
------------------------
Do you find this useful? (I hope so! :-) You will be able to drop the
dependency on a patched xgettext.) If so, when would this be needed to be
in an official gettext release, if KDE 4 is going to make use of it?
Also I'd like to make a minimal support of this syntax in kbabel. Simply
changing the PO file import and export filters, to transform
msgctxt "Help"
into
#. Context: Help
for kbabel's internal use would be enough. (The export filter would have
to convert it back to msgctxt syntax.) Just to make sure kbabel doesn't
spit on the translator when such a PO file is encountered.
Bruno
-------------------------------------------------------
--
Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kbabel/attachments/20051020/99228b87/attachment-0001.pgp
More information about the kbabel
mailing list