svghmi/i18n.ysl2
branchsvghmi
changeset 3108 079419e7228d
child 3112 bd20f9112014
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/svghmi/i18n.ysl2	Fri Jan 15 10:11:05 2021 +0100
@@ -0,0 +1,32 @@
+// i18n.ysl2
+
+
+template "svg:tspan", mode="extract_i18n" {
+    if "string-length(.) > 0" line {
+        value ".";
+    }
+}
+
+template "svg:text", mode="extract_i18n" {
+    msg {
+        attrib "id" value "@id";
+        attrib "label" value "@inkscape:label";
+        apply "svg:*", mode="extract_i18n";
+    }
+}
+
+const "translatable_texts", "//svg:text[starts-with(@inkscape:label, '_')]";
+const "translatable_strings" apply "$translatable_texts", mode="extract_i18n";
+
+emit "preamble:i18n" {
+    const "translations", "ns:GetTranslations($translatable_strings)";
+    | var translations = {
+    foreach "$translations/*" {
+    |     "«local-name()»":{
+        /* TODO */
+    |     }`if "position()!=last()" > ,`
+    }
+    | };
+    |
+
+}