diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java @ 2166:2898b1ff6013

I18N for WINFO calculation result messages. flys-artifacts/trunk@3758 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 24 Jan 2012 22:59:44 +0000
parents 2730d17df021
children ec2574eb2d32
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Mon Jan 23 17:39:51 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Tue Jan 24 22:59:44 2012 +0000
@@ -130,8 +130,7 @@
             }
             catch (ArgumentOutsideDomainException aode) {
                 if (errors != null) {
-                    // TODO: I18N
-                    errors.addProblem(km, "spline interpolation failed");
+                    errors.addProblem(km, "spline.interpolation.failed");
                 }
                 log.error("spline interpolation failed.", aode);
             }
@@ -222,9 +221,8 @@
                     double wo = other.getW(qPosition);
                     if (Double.isNaN(wt) || Double.isNaN(wo)) {
                         if (errors != null) {
-                            // TODO: I18N
                             errors.addProblem(
-                                km, "cannot find w for q = " + iqs[i]);
+                                km, "cannot.find.w.for.q", iqs[i]);
                         }
                         ows[i] = Double.NaN;
                     }
@@ -234,8 +232,7 @@
                 }
                 else {
                     if (errors != null) {
-                        // TODO: I18N
-                        errors.addProblem(km, "cannot find q = " + iqs[i]);
+                        errors.addProblem(km, "cannot.find.q", iqs[i]);
                     }
                     ows[i] = Double.NaN;
                 }
@@ -251,8 +248,7 @@
 
             if (W < 1) {
                 if (errors != null) {
-                    // TODO: I18N
-                    errors.addProblem(km, "no ws found");
+                    errors.addProblem(km, "no.ws.found");
                 }
                 return null;
             }
@@ -262,9 +258,8 @@
             for (int i = 0; i < W; ++i) {
                 double sq = table.getQIndex(i, km);
                 if (Double.isNaN(sq) && errors != null) {
-                    // TODO: I18N
                     errors.addProblem(
-                        km, "no q found in " + (i+1) + " column");
+                        km, "no.q.found.in.column", (i+1));
                 }
                 splineQs[i] = sq;
             }
@@ -278,8 +273,7 @@
             }
             catch (MathIllegalArgumentException miae) {
                 if (errors != null) {
-                    // TODO: I18N
-                    errors.addProblem(km, "spline creation failed");
+                    errors.addProblem(km, "spline.creation.failed");
                 }
                 log.error("spline creation failed", miae);
             }
@@ -296,8 +290,7 @@
 
             if (W < 1) {
                 if (errors != null) {
-                    // TODO: I18N
-                    errors.addProblem("no ws found");
+                    errors.addProblem("no.ws.found");
                 }
                 return null;
             }
@@ -316,8 +309,7 @@
 
                 if (Double.isNaN(wws) || Double.isNaN(wqs)) {
                     if (errors != null) {
-                        // TODO: I18N
-                        errors.addProblem(km, "cannot find w or q");
+                        errors.addProblem(km, "cannot.find.w.or.q");
                     }
                 }
 
@@ -335,8 +327,7 @@
             }
             catch (MathIllegalArgumentException miae) {
                 if (errors != null) {
-                    // TODO: I18N
-                    errors.addProblem(km, "spline creation failed");
+                    errors.addProblem(km, "spline.creation.failed");
                 }
                 log.error("spline creation failed", miae);
             }
@@ -559,17 +550,15 @@
             for (int i = 0; i < qs.length; ++i) {
                 if (getQPosition(km, qs[i], qPosition) == null) {
                     if (errors != null) {
-                        // TODO: I18N
-                        errors.addProblem(km, "cannot find q = " + qs[i]);
+                        errors.addProblem(km, "cannot.find.q", qs[i]);
                     }
                     ws[i] = Double.NaN;
                 }
                 else {
                     if (Double.isNaN(ws[i] = row.getW(qPosition))
                     && errors != null) {
-                        // TODO: I18N
                         errors.addProblem(
-                            km, "cannot find w for q = " + qs[i]);
+                            km, "cannot.find.w.for.q", qs[i]);
                     }
                 }
             }
@@ -581,8 +570,7 @@
                 // do not extrapolate
                 Arrays.fill(ws, Double.NaN);
                 if (errors != null) {
-                    // TODO: I18N
-                    errors.addProblem(km, "km not found");
+                    errors.addProblem(km, "km.not.found");
                 }
             }
             else {
@@ -626,8 +614,7 @@
         if (rowIndex < 1 || rowIndex >= rows.size()) {
             // do not extrapolate
             if (errors != null) {
-                // TODO: I18N
-                errors.addProblem(km, "km not found");
+                errors.addProblem(km, "km.not.found");
             }
             return new double[2][0];
         }
@@ -719,7 +706,7 @@
             Arrays.fill(ws, Double.NaN);
             Arrays.fill(qs, Double.NaN);
             if (errors != null) {
-                errors.addProblem(referenceKm, "cannot find q");
+                errors.addProblem(referenceKm, "cannot.find.q", q);
             }
             return null;
         }
@@ -732,7 +719,7 @@
 
             if (Double.isNaN(qs[i] = getQ(qPosition, kms[i]))) {
                 if (errors != null) {
-                    errors.addProblem(kms[i], "cannot find q");
+                    errors.addProblem(kms[i], "cannot.find.q", q);
                 }
                 ws[i] = Double.NaN;
                 continue;
@@ -745,7 +732,7 @@
                 // direct row match
                 if (Double.isNaN(ws[i] = rows.get(rowIndex).getW(qPosition))
                 && errors != null) {
-                    errors.addProblem(kms[i], "cannot find w");
+                    errors.addProblem(kms[i], "cannot.find.w.for.q", q);
                 }
                 continue;
             }
@@ -755,7 +742,7 @@
             if (rowIndex < 1 || rowIndex > R1) {
                 // do not extrapolate
                 if (errors != null) {
-                    errors.addProblem(kms[i], "cannot find km");
+                    errors.addProblem(kms[i], "km.not.found");
                 }
                 ws[i] = Double.NaN;
                 continue;
@@ -765,7 +752,7 @@
 
             if (Double.isNaN(ws[i] = r1.getW(r2, kms[i], qPosition))
             && errors != null) {
-                errors.addProblem(kms[i], "cannot find w");
+                errors.addProblem(kms[i], "cannot.find.w.for.q", q);
             }
         }
 
@@ -874,8 +861,7 @@
         if (rowIndex >= 0) {
             SplineFunction sf = rows.get(rowIndex).createSpline(this, errors);
             if (sf == null && errors != null) {
-                // TODO: I18N
-                errors.addProblem(km, "cannot create w/q relation");
+                errors.addProblem(km, "cannot.create.wq.relation");
             }
             return sf;
         }
@@ -885,8 +871,7 @@
         if (rowIndex < 1 || rowIndex >= rows.size()) {
             // Do not extrapolate.
             if (errors != null) {
-                // TODO: I18N
-                errors.addProblem(km, "km not found");
+                errors.addProblem(km, "km.not.found");
             }
             return null;
         }
@@ -897,8 +882,7 @@
 
         SplineFunction sf = r1.createSpline(r2, km, this, errors);
         if (sf == null && errors != null) {
-            // TODO: I18N
-            errors.addProblem(km, "cannot create w/q relation");
+            errors.addProblem(km, "cannot.create.wq.relation");
         }
 
         return sf;
@@ -924,8 +908,7 @@
         PolynomialSplineFunction iQ1 = sf1.createIndexQRelation();
         if (iQ1 == null) {
             if (errors != null) {
-                // TODO: I18N
-                errors.addProblem(km1, "cannot create index/q relation");
+                errors.addProblem(km1, "cannot.create.index.q.relation");
             }
             return new double[2][0];
         }
@@ -933,8 +916,7 @@
         PolynomialSplineFunction iQ2 = sf1.createIndexQRelation();
         if (iQ2 == null) {
             if (errors != null) {
-                // TODO: I18N
-                errors.addProblem(km2, "cannot create index/q relation");
+                errors.addProblem(km2, "cannot.create.index.q.relation");
             }
             return new double[2][0];
         }
@@ -969,9 +951,8 @@
                     //      and if we should report this more than once.
                     hadErrors = true;
                     if (errors != null) {
-                        // TODO: I18N
+                        errors.addProblem("relating.w.w.failed");
                         log.debug("W~W failed", aode);
-                        errors.addProblem("W~W failed");
                     }
                 }
             }

http://dive4elements.wald.intevation.org