changeset 8260:48d4921665e3

Making i18n work was just easier using less wrappers in this case (issue1631).
author Tom Gottfried <tom@intevation.de>
date Thu, 11 Sep 2014 17:37:03 +0200
parents 1fc453fbc5df
children 229fce4a1d3e
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterSubFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterTopFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterFacet.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties artifacts/src/main/resources/messages_de_DE.properties artifacts/src/main/resources/messages_en.properties
diffstat 10 files changed, 24 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterSubFacet.java	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterSubFacet.java	Thu Sep 11 17:37:03 2014 +0200
@@ -37,7 +37,7 @@
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
         this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
-        this.metaData.put("Y", "chart.bedquality.yaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterTopFacet.java	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterTopFacet.java	Thu Sep 11 17:37:03 2014 +0200
@@ -37,7 +37,7 @@
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
         this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
-        this.metaData.put("Y", "chart.bedquality.yaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java	Thu Sep 11 17:37:03 2014 +0200
@@ -30,7 +30,7 @@
     ) {
         super(ndx, name, description, type, hash, stateId);
         this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
-        this.metaData.put("Y", "chart.bedquality.yaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterFacet.java	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterFacet.java	Thu Sep 11 17:37:03 2014 +0200
@@ -38,7 +38,7 @@
         ComputeType type, String stateId, String hash) {
         super(idx, name, description, type, hash, stateId);
         this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
-        this.metaData.put("Y", "chart.bedquality.yaxis.label");
+        this.metaData.put("Y", "chart.bedquality.yaxis.label.diameter");
     }
 
     public Object getData(Artifact artifact, CallContext context) {
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Thu Sep 11 17:37:03 2014 +0200
@@ -13,6 +13,9 @@
 import org.apache.log4j.Logger;
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
 import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.CallMeta;
+
+import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.exports.DiagramGenerator;
 import org.dive4elements.river.exports.StyledSeriesBuilder;
@@ -24,8 +27,6 @@
     private final static Logger log =
             Logger.getLogger(BedQualityDensityProcessor.class);
 
-    public static final String I18N_AXIS_LABEL_DEFAULT =
-        "Dichte [t/m^3]";
     public static final String I18N_AXIS_LABEL =
         "chart.bedquality.yaxis.label.density";
 
@@ -66,11 +67,12 @@
 
     @Override
     public String getAxisLabel(DiagramGenerator generator) {
+
+        CallMeta meta = generator.getCallContext().getMeta();
+
         if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
-            return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
+            return Resources.getMsg(meta, yAxisLabel);
         }
-        return generator.msg(
-                I18N_AXIS_LABEL,
-                I18N_AXIS_LABEL_DEFAULT);
+        return Resources.getMsg(meta, I18N_AXIS_LABEL);
     }
 }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Thu Sep 11 17:37:03 2014 +0200
@@ -13,6 +13,9 @@
 import org.apache.log4j.Logger;
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
 import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.CallMeta;
+
+import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.exports.DiagramGenerator;
 import org.dive4elements.river.exports.StyledSeriesBuilder;
@@ -24,8 +27,6 @@
     private final static Logger log =
             Logger.getLogger(BedQualityDiameterProcessor.class);
 
-    public static final String I18N_AXIS_LABEL_DEFAULT =
-        "Durchmesser [mm]";
     public static final String I18N_AXIS_LABEL =
         "chart.bedquality.yaxis.label.diameter";
 
@@ -68,12 +69,13 @@
 
     @Override
     public String getAxisLabel(DiagramGenerator generator) {
+
+        CallMeta meta = generator.getCallContext().getMeta();
+
         if (yAxisLabel != null && !yAxisLabel.isEmpty()) {
-            return generator.msg(yAxisLabel, I18N_AXIS_LABEL_DEFAULT);
+            return Resources.getMsg(meta, yAxisLabel);
         }
-        return generator.msg(
-                I18N_AXIS_LABEL,
-                I18N_AXIS_LABEL_DEFAULT);
+        return Resources.getMsg(meta, I18N_AXIS_LABEL);
     }
 }
 
--- a/artifacts/src/main/resources/messages.properties	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/resources/messages.properties	Thu Sep 11 17:37:03 2014 +0200
@@ -218,7 +218,7 @@
 
 chart.bedquality.title=Bed Longitudinal Section
 chart.bedquality.xaxis.label={0}-km
-chart.bedquality.yaxis.label=Diameter [mm]
+chart.bedquality.yaxis.label.diameter = Diameter [mm]
 chart.bedquality.yaxis.label.porosity=Porosity [%]
 chart.bedquality.yaxis.label.density=Density [t/m\u00b3]
 
--- a/artifacts/src/main/resources/messages_de.properties	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Thu Sep 11 17:37:03 2014 +0200
@@ -218,7 +218,7 @@
 
 chart.bedquality.title=Sohlen L\u00e4ngsschnitt
 chart.bedquality.xaxis.label={0}-km
-chart.bedquality.yaxis.label=Durchmesser [mm]
+chart.bedquality.yaxis.label.diameter = Durchmesser [mm]
 chart.bedquality.yaxis.label.porosity=Porosit\u00e4t [%]
 chart.bedquality.yaxis.label.density=Dichte [t/m\u00b3]
 
--- a/artifacts/src/main/resources/messages_de_DE.properties	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Thu Sep 11 17:37:03 2014 +0200
@@ -217,7 +217,7 @@
 
 chart.bedquality.title=Sohlen L\u00e4ngsschnitt
 chart.bedquality.xaxis.label={0}-km
-chart.bedquality.yaxis.label=Durchmesser [mm]
+chart.bedquality.yaxis.label.diameter = Durchmesser [mm]
 chart.bedquality.yaxis.label.porosity=Porosit\u00e4t [%]
 chart.bedquality.yaxis.label.density=Dichte [t/m\u00b3]
 
--- a/artifacts/src/main/resources/messages_en.properties	Thu Sep 11 16:12:39 2014 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Thu Sep 11 17:37:03 2014 +0200
@@ -220,7 +220,7 @@
 
 chart.bedquality.title=Bed Longitudinal Section
 chart.bedquality.xaxis.label={0}-km
-chart.bedquality.yaxis.label=Diameter [mm]
+chart.bedquality.yaxis.label.diameter = Diameter [mm]
 chart.bedquality.yaxis.label.porosity=Porosity [%]
 chart.bedquality.yaxis.label.density=Density [t/m\u00b3]
 

http://dive4elements.wald.intevation.org