projects
/
jSite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove subversion $Id$ tags
[jSite.git]
/
src
/
de
/
todesbaum
/
jsite
/
i18n
/
I18n.java
diff --git
a/src/de/todesbaum/jsite/i18n/I18n.java
b/src/de/todesbaum/jsite/i18n/I18n.java
index
38a6916
..
fe7293d
100644
(file)
--- a/
src/de/todesbaum/jsite/i18n/I18n.java
+++ b/
src/de/todesbaum/jsite/i18n/I18n.java
@@
-20,19
+20,21
@@
package de.todesbaum.jsite.i18n;
import java.util.Locale;
package de.todesbaum.jsite.i18n;
import java.util.Locale;
+import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
import java.util.ResourceBundle;
/**
- * @author David Roden <droden@gmail.com>
- * @version $Id: I18n.java 355 2006-03-24 15:04:11Z bombe $
+ * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class I18n {
*/
public class I18n {
+ private static Locale defaultLocale = new Locale("en");
private static Locale currentLocale;
public static Locale getLocale() {
private static Locale currentLocale;
public static Locale getLocale() {
- if (currentLocale == null)
+ if (currentLocale == null)
{
currentLocale = Locale.getDefault();
currentLocale = Locale.getDefault();
+ }
return currentLocale;
}
return currentLocale;
}
@@
-50,7
+52,15
@@
public class I18n {
}
public static String getMessage(String key) {
}
public static String getMessage(String key) {
- return getResourceBundle().getString(key);
+ try {
+ return getResourceBundle().getString(key);
+ } catch (MissingResourceException mre1) {
+ try {
+ return getResourceBundle(defaultLocale).getString(key);
+ } catch (MissingResourceException mre2) {
+ return key;
+ }
+ }
}
}
}
}