script: Support translatable strings for properties

ClutterScript should be able to automatically call gettext() and friends
on strings loaded from a UI definition, prior to passing the string to
the object it is constructing.

The basic implementation is trivial:

  - set a translation domain on the ClutterScript instance
  - mark the translatable strings inside the JSON data, like:

      "property" : {
        "translatable" : true,
        "string" : "a translatable string"
      }

The hard part is now getting the tools we use to extract the
translatable strings to understand the JSON format we use inside
ClutterScript.
This commit is contained in:
Emmanuele Bassi
2012-03-06 14:23:33 +00:00
parent 4a9414ff87
commit 7646404196
5 changed files with 162 additions and 2 deletions

View File

@ -2,7 +2,7 @@
"My Scene" : {
"id" : "main-stage",
"type" : "ClutterStage",
"title" : "ClutterScript test",
"title" : { "translatable" : true, "string" : "ClutterScript test" },
"color" : "white",
"signals" : [
{ "name" : "key-press-event", "handler" : "clutter_main_quit" },
@ -62,7 +62,7 @@
"type" : "ClutterText",
"x" : 50,
"y" : 200,
"text" : "Clutter\tScript",
"text" : { "translatable" : true, "string" : "Clutter Script" },
"font-name" : "Sans 24px",
"color" : "black",
"line-alignment" : "center",