有人可以告诉我为什么语言环境芬兰语不起作用而其余的都起作用吗?
private static Map<String,Object> countries;
private static Locale finnishLocale = new Locale("fi", "FI");
static{
countries = new LinkedHashMap<String,Object>();
countries.put("English", Locale.ENGLISH); //label, value
countries.put("French", Locale.FRENCH);
countries.put("German", Locale.GERMAN);
countries.put("Finnish", finnishLocale); <---------- Not working!
}
public void setLocaleCode(String localeCode) {
this.localeCode = localeCode;
updateLocale(localeCode);
}
public void updateLocale(String newLocale){
String newLocaleValue = newLocale;
//loop country map to compare the locale code
for (Map.Entry<String, Object> entry : countries.entrySet()) {
if(entry.getValue().toString().equals(newLocaleValue)){
FacesContext.getCurrentInstance()
.getViewRoot().setLocale((Locale)entry.getValue());
}
}
}
我的意思是我用 New-clause 创建的语言环境不起作用。我无法更好地解释它,因为我认为这样实现的语言环境与例如 Locale.GERMAN 类似的语言环境对象?我的软件除了更新语言环境 ja Faces 上下文之外什么都不做。没有例外。对不起,如果q是愚蠢的。其他一切正常,我的意思是德语、英语等,并且程序会更新语言环境和 Faces 上下文。
如果您回答这个问题,我将不胜感激,我(再次)迷路了萨米