Implementing a JavaBean helper class to manage supported locales.
- By Gary Bollinger and Bharathi Natarajan
- October 16, 2000
Enterprise Java
Internationalize Your Web Site
Gary Bollinger and Bharathi Natarajan
Listing 3. Implementing a JavaBean helper class to manage supported locales.
package i18n;
import java.util.Locale;
public class i18nLocale {
private static Locale locale_ = null;
private static final Locale ENGLISH = new Locale("en", "US");
private static final Locale GERMAN = new Locale("de", "DE");
public static void
setLocale(String locale) {
if(locale.equals("de"))
locale_ = i18nLocale.GERMAN;
else
locale_ = i18nLocale.ENGLISH;
}
public static Locale getLocale() {
return locale_;
}
}