changeset 128:206312c2aa76

I18N of strings for the DESCRIBE document. flys-artifacts/trunk@1468 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 14 Mar 2011 16:32:42 +0000 (2011-03-14)
parents 21d791e21aca
children b06cd117b565
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_en.properties
diffstat 6 files changed, 41 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Mar 14 15:47:10 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Mar 14 16:32:42 2011 +0000
@@ -1,3 +1,14 @@
+2011-03-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/states/DefaultState.java:
+	  I18N of strings for the DESCRIBE document.
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties: I18N strings for the
+	  calculcation mode state.
+
 2011-03-14  Ingo Weinzierl <ingo@intevation.de>
 
 	* doc/conf/artifacts/winfo.xml: Modified the winfo states.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Mon Mar 14 15:47:10 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Mon Mar 14 16:32:42 2011 +0000
@@ -23,6 +23,7 @@
 import de.intevation.artifacts.common.utils.XMLUtils;
 
 import de.intevation.flys.artifacts.context.FLYSContext;
+import de.intevation.flys.artifacts.resources.Resources;
 
 
 /**
@@ -54,7 +55,7 @@
      * This method returns a description of this artifact.
      *
      * @param data Some data.
-     * @param CallContext The CallContext.
+     * @param context The CallContext.
      *
      * @return the description of this artifact.
      */
@@ -99,6 +100,8 @@
         Element staticUI  = ProtocolUtils.createArtNode(
             creator, "static", null, null);
 
+        appendStaticUI(creator, staticUI, context);
+
         Element dynamic = current.describe(
             description,
             root,
@@ -106,10 +109,9 @@
             identifier());
 
         ui.appendChild(dynamic);
+        ui.appendChild(staticUI);
         root.appendChild(ui);
 
-        appendStaticUI(creator, ui);
-
         return description;
     }
 
@@ -131,7 +133,11 @@
      * @param cr The ElementCreator that is used to create new elements.
      * @param ui The static ui node.
      */
-    protected void appendStaticUI(XMLUtils.ElementCreator cr, Node ui) {
+    protected void appendStaticUI(
+        XMLUtils.ElementCreator cr,
+        Node ui,
+        CallContext context)
+    {
         Set<String> keys = data.keySet();
 
         // XXX This just handles single selection string values. If we need more
@@ -141,9 +147,13 @@
         for (String k: keys) {
             logger.debug("The key = " + k);
             StateData d = getData(k);
+            String name = Resources.getMsg(
+                context.getMeta(),
+                d.getName(),
+                d.getName());
 
             Element dataElement = cr.create("data");
-            cr.addAttr(dataElement, "name", (String) d.getName(), true);
+            cr.addAttr(dataElement, "name", name, true);
             cr.addAttr(dataElement, "type", d.getType(), true);
 
             Element itemElement = cr.create("item");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Mon Mar 14 15:47:10 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Mon Mar 14 16:32:42 2011 +0000
@@ -85,9 +85,14 @@
         StateData   data,
         CallContext context)
     {
+        String name = Resources.getMsg(
+            context.getMeta(),
+            data.getName(),
+            data.getName());
+
         Element select = ProtocolUtils.createArtNode(
             cr, "select", null, null);
-        cr.addAttr(select, "name", data.getName());
+        cr.addAttr(select, "name", name, true);
 
         Element label = ProtocolUtils.createArtNode(
             cr, "label", null, null);
--- a/flys-artifacts/src/main/resources/messages.properties	Mon Mar 14 15:47:10 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages.properties	Mon Mar 14 16:32:42 2011 +0000
@@ -1,2 +1,5 @@
 state.winfo.river = River
 state.winfo.calculation_mode = Calculation Mode
+
+river = River
+calculation_mode = Calculation Mode
--- a/flys-artifacts/src/main/resources/messages_de.properties	Mon Mar 14 15:47:10 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Mon Mar 14 16:32:42 2011 +0000
@@ -1,2 +1,5 @@
 state.winfo.river = Fluss
 state.winfo.calculation_mode = Berechnungsart
+
+river = Fluss
+calculation_mode = Berechnungsart
--- a/flys-artifacts/src/main/resources/messages_en.properties	Mon Mar 14 15:47:10 2011 +0000
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Mon Mar 14 16:32:42 2011 +0000
@@ -1,2 +1,5 @@
 state.winfo.river = River
 state.winfo.calculation_mode = Calculation Mode
+
+river = River
+calculation_mode = Calculation Mode

http://dive4elements.wald.intevation.org