From: Matthias Clasen Date: Thu, 6 Nov 2003 00:43:48 +0000 (+0000) Subject: Add an i18n section. Include the corresponding entity. Template for i18n X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=fa65fd554b5883c8e0fd95571aec5e31462144a8;p=dana%2Fcg-glib.git 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. --- diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index d1f8f66f..320d5c03 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 9459933a..48c6d230 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 bdbce90b..eb26ee2f 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 4335b4f2..ee2793e8 100644 --- a/docs/reference/glib/running.sgml +++ b/docs/reference/glib/running.sgml @@ -23,12 +23,24 @@ GLib inspects a few of environment variables in addition to standard 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 00000000..812396d6 --- /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: + +