From 723961b749613aad05b6bd22d1f12479a0022bef Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 19 Dec 2014 20:42:21 +0000 Subject: [PATCH] gsettings: Expand documentation default value l10n Mention context, translation category, and the need for syntactic validity of the translated values. https://bugzilla.gnome.org/show_bug.cgi?id=741788 --- gio/gsettings.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/gio/gsettings.c b/gio/gsettings.c index 666a48acc..0c5ee25f8 100644 --- a/gio/gsettings.c +++ b/gio/gsettings.c @@ -97,9 +97,33 @@ * Similar to GConf, the default values in GSettings schemas can be * localized, but the localized values are stored in gettext catalogs * and looked up with the domain that is specified in the - * gettext-domain attribute of the or - * elements and the category that is specified in the l10n attribute of - * the element. + * `gettext-domain` attribute of the or + * elements and the category that is specified in the `l10n` attribute of + * the element. The string which is translated includes all text in + * the element, including any surrounding quotation marks. + * + * The `l10n` attribute must be set to `messages` or `time`, and sets the + * [locale category for + * translation](https://www.gnu.org/software/gettext/manual/html_node/Aspects.html#index-locale-categories-1). + * The `messages` category should be used by default; use `time` for + * translatable date or time formats. A translation comment can be added as an + * XML comment immediately above the element — it is recommended to + * add these comments to aid translators understand the meaning and + * implications of the default value. An optional translation `context` + * attribute can be set on the element to disambiguate multiple + * defaults which use the same string. + * + * For example: + * |[ + * + * ['bad', 'words'] + * ]| + * + * Translations of default values must remain syntactically valid serialized + * #GVariants (e.g. retaining any surrounding quotation marks) or runtime + * errors will occur. * * GSettings uses schemas in a compact binary form that is created * by the [glib-compile-schemas][glib-compile-schemas]