2002-11-02 20:11:42 +00:00
|
|
|
package org.thdl.util;
|
|
|
|
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.ResourceBundle;
|
2005-06-20 06:18:00 +00:00
|
|
|
|
2002-11-02 20:11:42 +00:00
|
|
|
import javax.swing.JComponent;
|
|
|
|
|
|
|
|
public class ThdlI18n {
|
|
|
|
private static Locale locale = null;
|
|
|
|
private static ResourceBundle resources = null;
|
|
|
|
|
|
|
|
private ThdlI18n() {}
|
|
|
|
|
|
|
|
public static ResourceBundle getResourceBundle() {
|
|
|
|
if (resources == null)
|
|
|
|
resources = ResourceBundle.getBundle("MessageBundle", getLocale());
|
|
|
|
return resources;
|
|
|
|
}
|
|
|
|
public static void setLocale(Locale l) {
|
|
|
|
Locale[] locales = Locale.getAvailableLocales();
|
|
|
|
for (int k=0; k<locales.length; k++)
|
|
|
|
if (locales[k].equals(locale)) {
|
|
|
|
JComponent.setDefaultLocale(l);
|
|
|
|
locale = l;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static Locale getLocale() {
|
|
|
|
if (locale == null)
|
|
|
|
locale = Locale.getDefault();
|
|
|
|
return locale;
|
|
|
|
}
|
|
|
|
}
|