From 36c3ea473870eb6861ca8b9d072fed97b140dc9e Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Wed, 15 Feb 2012 20:47:20 +0000 Subject: [PATCH] Moved resources for error messages translations out of META-INF. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1244705 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/math3/exception/util/LocalizedFormats.java | 3 ++- .../math3/exception/util}/LocalizedFormats_fr.properties | 0 src/site/xdoc/changes.xml | 4 ++++ .../commons/math3/exception/util/LocalizedFormatsTest.java | 6 ++++-- 4 files changed, 10 insertions(+), 3 deletions(-) rename src/main/resources/{META-INF/localization => assets/org/apache/commons/math3/exception/util}/LocalizedFormats_fr.properties (100%) diff --git a/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java b/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java index 0e2a9434e..9020de14b 100644 --- a/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java +++ b/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java @@ -376,8 +376,9 @@ public enum LocalizedFormats implements Localizable { /** {@inheritDoc} */ public String getLocalizedString(final Locale locale) { try { + final String path = LocalizedFormats.class.getName().replaceAll("\\.", "/"); ResourceBundle bundle = - ResourceBundle.getBundle("META-INF/localization/LocalizedFormats", locale); + ResourceBundle.getBundle("assets/" + path, locale); if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) { // the value of the resource is the translated format return bundle.getString(toString()); diff --git a/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties b/src/main/resources/assets/org/apache/commons/math3/exception/util/LocalizedFormats_fr.properties similarity index 100% rename from src/main/resources/META-INF/localization/LocalizedFormats_fr.properties rename to src/main/resources/assets/org/apache/commons/math3/exception/util/LocalizedFormats_fr.properties diff --git a/src/site/xdoc/changes.xml b/src/site/xdoc/changes.xml index 9de79eb03..0feb570b8 100644 --- a/src/site/xdoc/changes.xml +++ b/src/site/xdoc/changes.xml @@ -52,6 +52,10 @@ The type attribute can be add,update,fix,remove. If the output is not quite correct, check for invisible trailing spaces! --> + + Resources for error messages translations have been moved out of META-INF + folder in the jar, to avoid interferences with some build systems + Fixed "doubleValue" and "floatValue" method in "BigFraction" when numerator and denominator are larger than the range of the diff --git a/src/test/java/org/apache/commons/math3/exception/util/LocalizedFormatsTest.java b/src/test/java/org/apache/commons/math3/exception/util/LocalizedFormatsTest.java index c786095b5..8f8928ebe 100644 --- a/src/test/java/org/apache/commons/math3/exception/util/LocalizedFormatsTest.java +++ b/src/test/java/org/apache/commons/math3/exception/util/LocalizedFormatsTest.java @@ -41,9 +41,10 @@ public class LocalizedFormatsTest { @Test public void testAllKeysPresentInPropertiesFiles() { + final String path = LocalizedFormats.class.getName().replaceAll("\\.", "/"); for (final String language : new String[] { "fr" } ) { ResourceBundle bundle = - ResourceBundle.getBundle("META-INF/localization/LocalizedFormats", new Locale(language)); + ResourceBundle.getBundle("assets/" + path, new Locale(language)); for (LocalizedFormats message : LocalizedFormats.values()) { final String messageKey = message.toString(); boolean keyPresent = false; @@ -60,9 +61,10 @@ public class LocalizedFormatsTest { @Test public void testAllPropertiesCorrespondToKeys() { + final String path = LocalizedFormats.class.getName().replaceAll("\\.", "/"); for (final String language : new String[] { "fr" } ) { ResourceBundle bundle = - ResourceBundle.getBundle("META-INF/localization/LocalizedFormats", new Locale(language)); + ResourceBundle.getBundle("assets/" + path, new Locale(language)); for (final Enumeration keys = bundle.getKeys(); keys.hasMoreElements();) { final String propertyKey = keys.nextElement(); try {