From fa65fd554b5883c8e0fd95571aec5e31462144a8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 6 Nov 2003 00:43:48 +0000 Subject: [PATCH] Add an i18n section. Include the corresponding entity. Template for i18n Thu Nov 6 01:42:36 2003 Matthias Clasen * glib/glib-sections.txt: Add an i18n section. * glib/glib-docs.sgml: Include the corresponding entity. * glib/tmpl/i18n.sgml: Template for i18n section. Thu Nov 6 00:56:04 2003 Matthias Clasen * glib/running.sgml: Document G_FILENAME_ENCODING. --- docs/reference/ChangeLog | 10 ++++ docs/reference/glib/glib-docs.sgml | 2 + docs/reference/glib/glib-sections.txt | 11 ++++ docs/reference/glib/running.sgml | 14 +++++- docs/reference/glib/tmpl/i18n.sgml | 95 +++++++++++++++++++++++++++++++++++ 5 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 docs/reference/glib/tmpl/i18n.sgml diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index d1f8f66..320d5c0 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,13 @@ +Thu Nov 6 01:42:36 2003 Matthias Clasen + + * glib/glib-sections.txt: Add an i18n section. + * glib/glib-docs.sgml: Include the corresponding entity. + * glib/tmpl/i18n.sgml: Template for i18n section. + +Thu Nov 6 00:56:04 2003 Matthias Clasen + + * glib/running.sgml: Document G_FILENAME_ENCODING. + Sat Oct 25 01:07:45 2003 Matthias Clasen * gobject/tmpl/gparamspec.sgml: diff --git a/docs/reference/glib/glib-docs.sgml b/docs/reference/glib/glib-docs.sgml index 9459933..48c6d23 100644 --- a/docs/reference/glib/glib-docs.sgml +++ b/docs/reference/glib/glib-docs.sgml @@ -53,6 +53,7 @@ + @@ -126,6 +127,7 @@ synchronize their operation. &glib-String-Utility-Functions; &glib-Character-Set-Conversion; &glib-Unicode-Manipulation; + &glib-i18n; &glib-Date-and-Time-Functions; &glib-Random-Numbers; &glib-Hook-Functions; diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index bdbce90..eb26ee2 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -1960,3 +1960,14 @@ g_ucs4_to_utf16 g_ucs4_to_utf8 g_unichar_to_utf8 + +
+I18N +i18n +glib.h,glib/gi18n.h +_ +Q_ +N_ +g_strip_context + +
diff --git a/docs/reference/glib/running.sgml b/docs/reference/glib/running.sgml index 4335b4f..ee2793e 100644 --- a/docs/reference/glib/running.sgml +++ b/docs/reference/glib/running.sgml @@ -24,11 +24,23 @@ variables like LANG, PATH or HOME. + <envar>G_FILENAME_ENCODING</envar> + + + This environment variable can be set to a comma-separated list of character + set names. GLib assumes that filenames are encoded in the first character + set from that list rather than in UTF-8. The special token "@locale" can be + used to specify the character set for the current locale. + + + + <envar>G_BROKEN_FILENAMES</envar> If this environment variable is set, GLib assumes that filenames are in - the locale encoding rather than in UTF-8. + the locale encoding rather than in UTF-8. G_FILENAME_ENCODING takes + priority over G_BROKEN_FILENAMES. diff --git a/docs/reference/glib/tmpl/i18n.sgml b/docs/reference/glib/tmpl/i18n.sgml new file mode 100644 index 0000000..812396d --- /dev/null +++ b/docs/reference/glib/tmpl/i18n.sgml @@ -0,0 +1,95 @@ + +Internationalization + + +gettext support macros. + + + +GLib doesn't force any particular localization method upon its users. +But since GLib itself is localized using the gettext() mechanism, it seems +natural to offer the de-facto standard gettext() support macros in an +easy-to-use form. + + +In order to use these macros in an application, you must include +glib/gi18n.h. For use in a library, must include +glib/gi18n-lib.h after defining +the GETTEXT_PACKAGE macro suitably for your library: + +#define GETTEXT_PACKAGE "gtk20" +#include <glib/gi18n-lib.h> + + + + + +The gettext manual. + + + + + +Marks a string for translation, gets replaced with the translated string +at runtime. + + +@String: the string to be translated +@Since: 2.4 + + + +Like _(), but applies g_strip_context() to the translation. This has the +advantage that the string can be adorned with a prefix to guarantee +uniqueness and provide context to the translator. + + +One use case given in the gettext manual is GUI translation, where one could +e.g. disambiguate two "Open" menu entries as "File|Open" and "Printer|Open". +Another use case is the string "Russian" which may have to be translated +differently depending on whether it's the name of a character set or a +language. This could be solved by using "charset|Russian" and +"language|Russian". + + +@String: the string to be translated, with a '|'-separated prefix which + must not be translated +@Since: 2.4 + + + + +Marks a string for translation, gets replaced with the untranslated string +at runtime. This is useful in situations where the translated strings can't +be directly used, e.g. in string array initializers. + + + { + static const char *messages[] = { + N_("some very meaningful message"), + N_("and another one") + }; + const char *string; + ... + string + = index > 1 ? _("a default message") : gettext (messages[index]); + + fputs (string); + ... + } + + +@String: the string to be translated +@Since: 2.4 + + + + + + + +@msgid: +@msgval: +@Returns: + + -- 2.7.4