[PATCH] Making i18n work was just easier using less wrappers in this case (issue1631)
Wald Commits
scm-commit at wald.intevation.org
Thu Sep 11 17:37:06 CEST 2014
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1410449823 -7200
# Node ID 48d4921665e30014e52271b0228d85e4655d1f45
# Parent 1fc453fbc5df1a8fd7db518e784c85fb652c1ab0
Making i18n work was just easier using less wrappers in this case (issue1631).
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterSubFacet.java
--- 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) {
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiameterTopFacet.java
--- 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) {
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterDataFacet.java
--- 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) {
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedloadDiameterFacet.java
--- 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) {
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java
--- 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);
}
}
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java
--- 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);
}
}
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/resources/messages.properties
--- 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]
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/resources/messages_de.properties
--- 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]
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/resources/messages_de_DE.properties
--- 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]
diff -r 1fc453fbc5df -r 48d4921665e3 artifacts/src/main/resources/messages_en.properties
--- 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]
More information about the Dive4Elements-commits
mailing list