# HG changeset patch # User Felix Wolfsteller # Date 1318331800 0 # Node ID 6e59208839aea026de7f9c444d3a1f0f25a73cfb # Parent 13a9ee6cebefe0af45442e9ca91f92a98b1b5fe8 Expose translateable Strings as constants. flys-artifacts/trunk@2935 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 13a9ee6cebef -r 6e59208839ae flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue Oct 11 10:44:12 2011 +0000 +++ b/flys-artifacts/ChangeLog Tue Oct 11 11:16:40 2011 +0000 @@ -1,3 +1,9 @@ +2011-10-11 Felix Wolfsteller + + * src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java, + src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java: + Expose translateable Strings as constants. + 2011-10-11 Felix Wolfsteller Fix most labels in w-differences charts. diff -r 13a9ee6cebef -r 6e59208839ae flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Tue Oct 11 10:44:12 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Tue Oct 11 11:16:40 2011 +0000 @@ -46,6 +46,34 @@ public static final String I18N_ANNOTATIONS_LABEL = "chart.longitudinal.annotations.label"; + /** + * Key to look up internationalized String for LongitudinalSection diagrams + * titles. + */ + public static final String I18N_CHART_TITLE = + "chart.longitudinal.section.title"; + + /** + * Key to look up internationalized String for LongitudinalSection diagrams + * subtitles. + */ + public static final String I18N_CHART_SUBTITLE = + "chart.longitudinal.section.subtitle"; + + 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\u00e4ngsschnitt"; + 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\u00b3/s]"; + /** Whether or not the plot is inverted (left-right). */ protected boolean inverted; @@ -69,7 +97,7 @@ * Get internationalized title for chart. */ public String getChartTitle() { - return msg("chart.longitudinal.section.title", "W-L\u00e4ngsschnitt"); + return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT); } @@ -78,7 +106,7 @@ * @return key to look up translated subtitle. */ protected String getChartSubtitleKey() { - return "chart.longitudinal.section.subtitle"; + return I18N_CHART_SUBTITLE; } @@ -107,8 +135,8 @@ FLYSArtifact flys = (FLYSArtifact) master; return msg( - "chart.longitudinal.section.xaxis.label", - "km", + I18N_XAXIS_LABEL, + I18N_XAXIS_LABEL_DEFAULT, new Object[] { FLYSUtils.getRiver(flys).getName() }); } @@ -122,8 +150,8 @@ String unit = FLYSUtils.getRiver(flys).getWstUnit().getName(); return msg( - "chart.longitudinal.section.yaxis.label", - "W [NN + m]", + I18N_YAXIS_LABEL, + I18N_YAXIS_LABEL_DEFAULT, new Object[] { unit }); } @@ -133,7 +161,7 @@ * found). */ protected String get2YAxisDefaultLabel() { - return "Q [m\u00b3/s]"; + return I18N_2YAXIS_LABEL_DEFAULT; } @@ -141,7 +169,7 @@ * Get key for internationalization of the second Y-Axis' label. */ protected String get2YAxisLabelKey() { - return "chart.longitudinal.section.yaxis.second.label"; + return I18N_2YAXIS_LABEL; } diff -r 13a9ee6cebef -r 6e59208839ae flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java Tue Oct 11 10:44:12 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WDifferencesCurveGenerator.java Tue Oct 11 11:16:40 2011 +0000 @@ -35,12 +35,33 @@ private static Logger logger = Logger.getLogger(WDifferencesCurveGenerator.class); + /** Key for internationalized title of WDiff charts. */ + public final static String I18N_WDIFF_TITLE = "chart.w_differences.title"; + + /** Default for internationalized title (when no translation found). */ + public final static String I18N_WDIFF_TITLE_DEFAULT = "Differences"; + + /** Key for internationalized title of WDiff charts. */ + public final static String I18N_WDIFF_2YAXIS_LABEL = + "chart.w_differences.yaxis.second.label"; + + /** Default for label for second Y-Axis when no translation found. */ + public final static String I18N_WDIFF_2YAXIS_LABEL_DEFAULT = "W [NN + m]"; + + public final static String I18N_WDIFF_SUBTITLE = + "chart.w_differences.subtitle"; + + public final static String I18N_WDIFF_YAXIS_LABEL = + "chart.w_differences.yaxis.label"; + + public final static String I18N_WDIFF_YAXIS_LABEL_DEFAULT = "m"; + /** * Get internationalized title for chart. */ public String getChartTitle() { - return msg("chart.w_differences.title", "Differences"); + return msg(I18N_WDIFF_TITLE, I18N_WDIFF_TITLE_DEFAULT); } @@ -50,7 +71,7 @@ */ @Override protected String get2YAxisDefaultLabel() { - return "W [NN + m]"; + return I18N_WDIFF_2YAXIS_LABEL_DEFAULT; } @@ -60,7 +81,7 @@ */ @Override protected String getChartSubtitleKey() { - return "chart.w_differences.subtitle"; + return I18N_WDIFF_SUBTITLE; } @@ -69,7 +90,7 @@ */ @Override protected String get2YAxisLabelKey() { - return "chart.w_differences.yaxis.second.label"; + return I18N_WDIFF_2YAXIS_LABEL; } @@ -83,8 +104,8 @@ String unit = FLYSUtils.getRiver(flys).getWstUnit().getName(); return msg( - "chart.w_differences.yaxis.label", - "m", + I18N_WDIFF_YAXIS_LABEL, + I18N_WDIFF_YAXIS_LABEL_DEFAULT, new Object[] { unit }); }