[clutter] clutter-script: Add an example of translation in ClutterScript
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] clutter-script: Add an example of translation in ClutterScript
- Date: Wed, 24 Aug 2016 12:12:51 +0000 (UTC)
commit 3de11d5a01884a56e431dafde0a31b3fc1d7ae5e
Author: Philip Withnall <philip withnall collabora co uk>
Date: Tue Aug 23 18:05:02 2016 +0100
clutter-script: Add an example of translation in ClutterScript
Document the ‘translatable’ key and friends.
https://bugzilla.gnome.org/show_bug.cgi?id=770288
clutter/clutter-script.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-script.c b/clutter/clutter-script.c
index cd58e9d..0550cee 100644
--- a/clutter/clutter-script.c
+++ b/clutter/clutter-script.c
@@ -200,6 +200,30 @@
* animating to it. State changes on signal emission will not affect
* the signal emission chain.
*
+ * ClutterScript supports translation using gettext: if a "translatable" key is
+ * added to a property value, it will be passed through g_dgettext() before
+ * being set on the created object. For example, to mark the #ClutterText:text
+ * property as being translatable:
+ *
+ * |[
+ * {
+ * "id" : "label",
+ * "type" : "ClutterText",
+ * "text" : { "translatable" : true, "string" : "Clutter Script" }
+ * }
+ * ]|
+ *
+ * In order for translation to work, the C runtime locale must have been set
+ * using setlocale() before loading the #ClutterScript, and the translation
+ * domain must have been set using textdomain(). If the strings in the script
+ * are in a different translation domain from the rest of the program, use
+ * clutter_script_set_translation_domain() to set the domain for the
+ * #ClutterScript only.
+ *
+ * As well as the "translatable" key, ClutterScript supports optional "domain"
+ * and "context" keys for specifying the message domain (if it is not the
+ * default) and context for disambiguating it from other equal message strings.
+ *
* Clutter reserves the following names, so classes defining properties
* through the usual GObject registration process should avoid using these
* names to avoid collisions:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]