summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 76e01a1)
raw | patch | inline | side by side (parent: 76e01a1)
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | |
Fri, 10 Sep 2010 19:21:47 +0000 (19:21 +0000) | ||
committer | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | |
Sat, 30 Oct 2010 07:58:19 +0000 (07:58 +0000) |
Change po/README's "Marking strings for translation" section so that
it covers the gettext.h C interface.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
it covers the gettext.h C interface.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
po/README | patch | blob | history |
diff --git a/po/README b/po/README
index 4dc0c2d985b38b9983b49378bbcda836fa0b9afb..fea8bf8723cbeae245f59de3a869133540522620 100644 (file)
--- a/po/README
+++ b/po/README
/* TRANSLATORS: %s will be "revert" or "cherry-pick" */
die(_("%s: Unable to write new index file"), me);
+
+We provide wrappers for C, Shell and Perl programs. Here's how they're
+used:
+
+C:
+
+ - Include builtin.h at the top, it'll pull in in gettext.h, which
+ defines the gettext interface. Consult with the list if you need to
+ use gettext.h directly.
+
+ - The C interface is a subset of the normal GNU gettext
+ interface. We currently export these functions:
+
+ - _()
+
+ Mark and translate a string. E.g.:
+
+ printf(_("HEAD is now at %s"), hex);
+
+ - N_()
+
+ A no-op pass-through macro for marking strings inside static
+ initializations, e.g.:
+
+ static const char *reset_type_names[] = {
+ N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
+ };
+
+ And then, later:
+
+ die(_("%s reset is not allowed in a bare repository"),
+ _(reset_type_names[reset_type]));
+
+ Here _() couldn't have statically determined what the translation
+ string will be, but since it was already marked for translation
+ with N_() the look-up in the message catalog will succeed.