# HG changeset patch # User Ingo Weinzierl # Date 1304945629 0 # Node ID fc3ac59c3c8bca1b5f30b70d4e75d5c7d36979b0 # Parent 9eb5f0c8fe7f6b514e52fc1ac40162b38b51b6a6 Enabled i18n support for charts. flys-artifacts/trunk@1865 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon May 09 12:53:49 2011 +0000 @@ -1,3 +1,20 @@ +2011-05-09 Ingo Weinzierl + + * src/main/java/de/intevation/flys/exports/ChartGenerator.java: Added a + method to retrieve i18n strings. + + * src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java, + src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java, + src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java, + src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java: + Enabled i18n support for chart title and axes labels. + + * src/main/resources/messages.properties, + src/main/resources/messages_de_DE.properties, + src/main/resources/messages_en.properties, + src/main/resources/messages_de.properties: Added i18n strings for the + chart types above. + 2011-05-09 Ingo Weinzierl * src/main/java/de/intevation/flys/exports/DischargeLongitudinalSectionExporter.java: diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Mon May 09 12:53:49 2011 +0000 @@ -8,6 +8,7 @@ import org.w3c.dom.Document; import de.intevation.artifacts.Artifact; +import de.intevation.flys.artifacts.resources.Resources; import de.intevation.artifacts.CallContext; @@ -41,6 +42,11 @@ } + protected String msg(String key, String def) { + return Resources.getMsg(context.getMeta(), key, def); + } + + public abstract void doOut(Artifact artifact, String facet, Document attr); public abstract void generate() throws IOException; diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ComputedDischargeCurveGenerator.java Mon May 09 12:53:49 2011 +0000 @@ -22,15 +22,25 @@ Logger.getLogger(ComputedDischargeCurveGenerator.class); + public static final String I18N_CHART_TITLE = + "chart.computed.discharge.curve.title"; + + public static final String I18N_YAXIS_LABEL = + "chart.computed.discharge.curve.yaxis.label"; + + public static final String I18N_CHART_TITLE_DEFAULT = "Abflusskurve"; + public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; + + @Override protected String getChartTitle() { - return "Abflusskurve"; + return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); } @Override protected String getYAxisLabel() { - return "W [NN + m]"; + return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); } diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DischargeCurveGenerator.java Mon May 09 12:53:49 2011 +0000 @@ -34,6 +34,20 @@ Logger.getLogger(DischargeCurveGenerator.class); + public static final String I18N_CHART_TITLE = + "chart.discharge.curve.title"; + + public static final String I18N_XAXIS_LABEL = + "chart.discharge.curve.xaxis.label"; + + public static final String I18N_YAXIS_LABEL = + "chart.discharge.curve.yaxis.label"; + + public static final String I18N_CHART_TITLE_DEFAULT = "Abflusskurven"; + public static final String I18N_XAXIS_LABEL_DEFAULT = "Q [m³/s]"; + public static final String I18N_YAXIS_LABEL_DEFAULT = "W [cm]"; + + /** The Dataset that contains the data for the chart.*/ protected DefaultXYDataset dataset; @@ -46,17 +60,17 @@ protected String getChartTitle() { - return "Abflusskurven"; + return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); } protected String getXAxisLabel() { - return "Q[m³/s]"; + return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); } protected String getYAxisLabel() { - return "W[cm]"; + return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); } diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveGenerator.java Mon May 09 12:53:49 2011 +0000 @@ -39,6 +39,24 @@ public static final String DURATION_CURVE_Q = "duration_curve.q"; + public static final String I18N_CHART_TITLE = + "chart.duration.curve.title"; + + public static final String I18N_XAXIS_LABEL = + "chart.duration.curve.xaxis.label"; + + public static final String I18N_YAXIS_LABEL = + "chart.duration.curve.yaxis.label"; + + public static final String I18N_CHART_TITLE_DEFAULT = + "Dauerlinie"; + + public static final String I18N_XAXIS_LABEL_DEFAULT = + "Unterschreitungsdauer [Tage]"; + + public static final String I18N_YAXIS_LABEL_DEFAULT = + "W [NN + m]"; + public DurationCurveGenerator() { super(); @@ -49,19 +67,17 @@ protected String getChartTitle() { - // TODO i18n - return "Wasserstand für Gewässer"; + return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); } protected String getXAxisLabel() { - // TODO i18n - return "Unterschreitungsdauer [Tagen]"; + return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); } protected String getYAxisLabel() { - return "W [NN + m]"; + return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); } diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Mon May 09 12:53:49 2011 +0000 @@ -34,6 +34,22 @@ public static final String LONGITUDINAL_SECTION_Q = "longitudinal_section.q"; + public static final String I18N_CHART_TITLE = + "chart.longitudinal.section.title"; + + public static final String I18N_XAXIS_LABEL = + "chart.longitudinal.section.xaxis.label"; + + public static final String I18N_YAXIS_LABEL = + "chart.longitudinal.section.yaxis.label"; + + public static final String I18N_2YAXIS_LABEL = + "chart.longitudinal.section.yaxis.second.label"; + + public static final String I18N_CHART_TITLE_DEFAULT = "W-Längsschnitt"; + public static final String I18N_XAXIS_LABEL_DEFAULT = "km"; + public static final String I18N_YAXIS_LABEL_DEFAULT = "W [NN + m]"; + public static final String I18N_2YAXIS_LABEL_DEFAULT = "Q [m³/s]"; /** The storage for the W series to be drawn in this chart.*/ protected XYSeriesCollection w; @@ -51,18 +67,17 @@ protected String getChartTitle() { - // TODO i18n - return "Wasserstand für Gewässer"; + return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); } protected String getXAxisLabel() { - return "km"; + return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT); } protected String getYAxisLabel() { - return "W [NN + m]"; + return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT); } @@ -77,7 +92,8 @@ protected void adjustAxes(XYPlot plot) { super.adjustAxes(plot); - NumberAxis qAxis = new NumberAxis("Q [m³/s]"); + NumberAxis qAxis = new NumberAxis( + msg(I18N_2YAXIS_LABEL, I18N_2YAXIS_LABEL_DEFAULT)); plot.setRangeAxis(2, qAxis); plot.mapDatasetToRangeAxis(1, 2); diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/src/main/resources/messages.properties --- a/flys-artifacts/src/main/resources/messages.properties Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Mon May 09 12:53:49 2011 +0000 @@ -14,3 +14,16 @@ river = River calculation_mode = Calculation Mode ld_locations = Location(s) + +chart.longitudinal.section.title = W-Longitudinal Section +chart.longitudinal.section.xaxis.label = km +chart.longitudinal.section.yaxis.label = W [NN + m] +chart.longitudinal.section.yaxis.second.label = Q [m\u00b3/s] +chart.discharge.curve.title = Discharge Curve +chart.discharge.curve.xaxis.label = Q [m\u00b3/s] +chart.discharge.curve.yaxis.label = W [cm] +chart.computed.discharge.curve.title = Discharge Curve +chart.computed.discharge.curve.yaxis.label = W [NN + m] +chart.duration.curve.title = Duration Curve +chart.duration.curve.xaxis.label = Duration of Non-Exceedence [Days] +chart.duration.curve.yaxis.label = W [NN + m] diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/src/main/resources/messages_de.properties --- a/flys-artifacts/src/main/resources/messages_de.properties Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Mon May 09 12:53:49 2011 +0000 @@ -14,3 +14,16 @@ river = Fluss calculation_mode = Berechnungsart ld_locations = Ort(e) + +chart.longitudinal.section.title = W-L\u00e4ngsschnitt +chart.longitudinal.section.xaxis.label = km +chart.longitudinal.section.yaxis.label = W [NN + m] +chart.longitudinal.section.yaxis.second.label = Q [m\u00b3/s] +chart.discharge.curve.title = Abflusskurve +chart.discharge.curve.xaxis.label = Q [m\u00b3/s] +chart.discharge.curve.yaxis.label = W [cm] +chart.computed.discharge.curve.title = Abflusskurve +chart.computed.discharge.curve.yaxis.label = W [NN + m] +chart.duration.curve.title = Dauerlinie +chart.duration.curve.xaxis.label = Unterschreitungsdauer [Tage] +chart.duration.curve.yaxis.label = W [NN + m] diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/src/main/resources/messages_de_DE.properties --- a/flys-artifacts/src/main/resources/messages_de_DE.properties Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Mon May 09 12:53:49 2011 +0000 @@ -14,3 +14,16 @@ river = Fluss calculation_mode = Berechnungsart ld_locations = Ort(e) + +chart.longitudinal.section.title = W-L\u00e4ngsschnitt +chart.longitudinal.section.xaxis.label = km +chart.longitudinal.section.yaxis.label = W [NN + m] +chart.longitudinal.section.yaxis.second.label = Q [m\u00b3/s] +chart.discharge.curve.title = Abflusskurve +chart.discharge.curve.xaxis.label = Q [m\u00b3/s] +chart.discharge.curve.yaxis.label = W [cm] +chart.computed.discharge.curve.title = Abflusskurve +chart.computed.discharge.curve.yaxis.label = W [NN + m] +chart.duration.curve.title = Dauerlinie +chart.duration.curve.xaxis.label = Unterschreitungsdauer [Tage] +chart.duration.curve.yaxis.label = W [NN + m] diff -r 9eb5f0c8fe7f -r fc3ac59c3c8b flys-artifacts/src/main/resources/messages_en.properties --- a/flys-artifacts/src/main/resources/messages_en.properties Mon May 09 09:55:47 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Mon May 09 12:53:49 2011 +0000 @@ -14,3 +14,16 @@ river = River calculation_mode = Calculation Mode ld_locations = Location(s) + +chart.longitudinal.section.title = W-Longitudinal Section +chart.longitudinal.section.xaxis.label = km +chart.longitudinal.section.yaxis.label = W [NN + m] +chart.longitudinal.section.yaxis.second.label = Q [m\u00b3/s] +chart.discharge.curve.title = Discharge Curve +chart.discharge.curve.xaxis.label = Q [m\u00b3/s] +chart.discharge.curve.yaxis.label = W [cm] +chart.computed.discharge.curve.title = Discharge Curve +chart.computed.discharge.curve.yaxis.label = W [NN + m] +chart.duration.curve.title = Duration Curve +chart.duration.curve.xaxis.label = Duration of Non-Exceedence [Days] +chart.duration.curve.yaxis.label = W [NN + m]