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
This commit is contained in:
Luc Maisonobe 2012-02-15 20:47:20 +00:00
parent 825e095cbf
commit 36c3ea4738
4 changed files with 10 additions and 3 deletions

View File

@ -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());

View File

@ -52,6 +52,10 @@ The <action> type attribute can be add,update,fix,remove.
If the output is not quite correct, check for invisible trailing spaces!
-->
<release version="3.0" date="TBD" description="TBD">
<action dev="luc" type="update">
Resources for error messages translations have been moved out of META-INF
folder in the jar, to avoid interferences with some build systems
</action>
<action dev="erans" type="fix" issue="MATH-744" due-to="Thundre">
Fixed "doubleValue" and "floatValue" method in "BigFraction" when
numerator and denominator are larger than the range of the

View File

@ -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<String> keys = bundle.getKeys(); keys.hasMoreElements();) {
final String propertyKey = keys.nextElement();
try {