User: janaudy
Date: 00/09/15 09:07:09
Modified: webstore/src/org/jboss/zol/webstore/i18n I18NManager.java
ZOLI18N_en.java ZOLI18N_de.java ZOLI18N_fi.java
ZOLI18N_fr.java
Log:
Added some texts and support for Finnish (Juha :-))
in the I18N manager.
Revision Changes Path
1.2 +20 -16 zola/webstore/src/org/jboss/zol/webstore/i18n/I18NManager.java
Index: I18NManager.java
===================================================================
RCS file:
/products/cvs/ejboss/zola/webstore/src/org/jboss/zol/webstore/i18n/I18NManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- I18NManager.java 2000/05/10 14:43:45 1.1
+++ I18NManager.java 2000/09/15 16:07:08 1.2
@@ -13,39 +13,42 @@
* @date April 06, 2000
*/
public final class I18NManager {
+ // The Finnish locale does not exist in the Locale object.
+ public static final Locale FINNISH = new Locale("fi", "FI");
+
/**
* instance
*/
private static I18NManager instance = new I18NManager();
-
+
/**
* defaultLocale
*/
private static final Locale defaultLocale = Locale.ENGLISH;
-
+
/**
* Package name
*/
private static final String pkgName = "org.jboss.zol.webstore.i18n.ZOLI18N";
-
+
/**
* Hashtable that contains the locales and the bundles associated
* with the locale
*/
private static Hashtable bundles = null;
-
+
static {
ResourceBundle bundle = ResourceBundle.getBundle(pkgName, defaultLocale);
bundles = new Hashtable();
bundles.put(defaultLocale, bundle);
}
-
+
/**
* Constructor. Creates the default bundle, which is english.
*/
private I18NManager() {
}
-
+
/**
* Return the internationalized String object associated with a Locale.
* If the locale does not exist we try to add it to the hastable.
@@ -61,25 +64,26 @@
bundle = ResourceBundle.getBundle(pkgName, locale);
bundles.put(locale, bundle);
} catch (Exception e) {
- //System.err.println("No locale found by the CLASSLOADER");
+ System.err.println("No locale found by the CLASSLOADER");
+ e.printStackTrace();
locale = defaultLocale;
}
} else if (locale == null)
locale = defaultLocale;
-
+
String i18nString = null;
try {
i18nString = ((ResourceBundle)bundles.get(locale)).getString(key);
} catch (Exception e2) {
- //System.err.println("Key string not found in locale "+locale);
+ System.err.println("Key string not found in locale "+locale);
i18nString = key;
}
-
+
//System.err.println("... returning: "+i18nString);
-
+
return i18nString;
}
-
+
/**
* Return the localized number.
* @param d a double
@@ -88,19 +92,19 @@
public static String getLocalizedNumber(double d, Locale l) {
if (l == null)
l = defaultLocale;
-
+
Double amount = new Double(d);
NumberFormat numberFormatter = null;
String amountOut = null;
-
+
numberFormatter = NumberFormat.getNumberInstance(l);
amountOut = numberFormatter.format(amount);
-
+
//System.err.println("Localizing "+d+", and returning "+amountOut);
return amountOut;
}
-
+
/**
* Get the instance
* @return instance
1.3 +3 -0 zola/webstore/src/org/jboss/zol/webstore/i18n/ZOLI18N_en.java
Index: ZOLI18N_en.java
===================================================================
RCS file:
/products/cvs/ejboss/zola/webstore/src/org/jboss/zol/webstore/i18n/ZOLI18N_en.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ZOLI18N_en.java 2000/05/22 17:00:01 1.2
+++ ZOLI18N_en.java 2000/09/15 16:07:08 1.3
@@ -77,6 +77,9 @@
{"zol.servlet.submit", "Submit"},
{"zol.servlet.reset", "Reset"},
{"zol.error.passwordincorrect", "Password incorrect, please try again."},
+ {"zol.main.loginsexpl", "Please log in, if you are not in the database, <BR>"+
+ "you will be forwarded to the create account page.<BR>"+
+ "You can use the following logins, passwords to try the
web site:"},
{"zol.languages.english", "English"}
};
}
1.2 +4 -1 zola/webstore/src/org/jboss/zol/webstore/i18n/ZOLI18N_de.java
Index: ZOLI18N_de.java
===================================================================
RCS file:
/products/cvs/ejboss/zola/webstore/src/org/jboss/zol/webstore/i18n/ZOLI18N_de.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ZOLI18N_de.java 2000/05/10 14:44:31 1.1
+++ ZOLI18N_de.java 2000/09/15 16:07:08 1.2
@@ -72,6 +72,9 @@
{"zol.servlet.submit", "Submit"},
{"zol.servlet.reset", "Reset"},
{"zol.error.passwordincorrect", "Password incorrect, please try again."},
- {"zol.languages.english", "English"}
+ {"zol.main.loginsexpl", "Please log in, if you are not in the database, <BR>"+
+ "you will be forwarded to the create account page.<BR>"+
+ "You can use the following logins, passwords to try the
web site:"},
+ {"zol.languages.german", "German"}
};
}
1.2 +4 -1 zola/webstore/src/org/jboss/zol/webstore/i18n/ZOLI18N_fi.java
Index: ZOLI18N_fi.java
===================================================================
RCS file:
/products/cvs/ejboss/zola/webstore/src/org/jboss/zol/webstore/i18n/ZOLI18N_fi.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ZOLI18N_fi.java 2000/05/26 18:25:48 1.1
+++ ZOLI18N_fi.java 2000/09/15 16:07:08 1.2
@@ -78,6 +78,9 @@
{"zol.servlet.reset", "Tyhjenn�"},
{"zol.error.passwordincorrect", "Salasana oli v��rin. Ole hyv� ja yrit�
uudestaan."},
{"zol.languages.english", "englanti"},
- {"zol.languages.finnish", "suomi"}
+ {"zol.main.loginsexpl", "Please log in, if you are not in the database, <BR>"+
+ "you will be forwarded to the create account page.<BR>"+
+ "You can use the following logins, passwords to try the
web site:"},
+ {"zol.languages.finnish", "Suomi"}
};
}
1.3 +3 -0 zola/webstore/src/org/jboss/zol/webstore/i18n/ZOLI18N_fr.java
Index: ZOLI18N_fr.java
===================================================================
RCS file:
/products/cvs/ejboss/zola/webstore/src/org/jboss/zol/webstore/i18n/ZOLI18N_fr.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ZOLI18N_fr.java 2000/05/22 17:00:18 1.2
+++ ZOLI18N_fr.java 2000/09/15 16:07:09 1.3
@@ -72,6 +72,9 @@
{"zol.servlet.submit", "Soumettre"},
{"zol.servlet.reset", "Reinitialiser"},
{"zol.error.passwordincorrect", "Mot de passe incorrect! Essayez encore
s.v.p."},
+ {"zol.main.loginsexpl", "Logez vous, si vous n'etes pas dans la base de
donnees, <BR>"+
+ "vous pourrez vous enregistrer.<BR>"+
+ "Vous pouvez utiliser les logins et mots de passe
suivants:"},
{"zol.languages.french", "Francais"}
};
}