My problem is that I cannot get localization to work with FacesMessage
I tried:
try { ResourceBundle bundle = ResourceBundle.getBundle("translations", context.getViewRoot().getLocale()); text = bundle.getString("loginFail"); } catch (Exception e) { System.out.println("EXCEPTION: " + e); } FacesContext.getCurrentInstance().addMessage("", new FacesMessage(text));
but the following exception is thrown
java.util.MissingResourceException: Can't find bundle for base name translations, locale cs
faces-config.xml contains:
<application> <locale-config> <default-locale>cs</default-locale> <supported-locale>en</supported-locale> </locale-config> <resource-bundle> <base-name>tr.translations</base-name> <var>txt</var> </resource-bundle> <message-bundle> tr.translations </message-bundle> </application>
The translations_cs.properties and translations_en.properties files are in the tr package, the location is definitely normal.
Do you have an idea how to make it work? thanks in advance
jsf localization
El_w
source share