the last post is just about validator.addErrorMessageVariable("errorMessage", myLocalizedErrorMessage). I found a related thread, which unfortunately does not help.
The return new DSResponse().setFailure(myLocalizedMessage) is working as expected, thank you.
For anyone interested:
Code:
public class I18n {
public static String getString(String key, HttpServletRequest httpServletRequest) {
/* Use the following line in development, when you want to add strings in a running Tomcat instance without restarting Tomcat */
// ResourceBundle.clearCache();
ResourceBundle labels = null;
// Find the first matching language from the request
for (Enumeration<Locale> e = httpServletRequest.getLocales(); e.hasMoreElements();) {
Locale currentLocale = e.nextElement();
labels = ResourceBundle.getBundle("com.mypackage.server.i18n.I18n", currentLocale);
if (labels.getLocale().getLanguage().equals(currentLocale.getLanguage()))
break;
}
return labels.getString(key);
}
}
Code:
<echo>Converting server i18n files (UTF-8 to ASCII)</echo>
<exec executable="${java.sdk}/bin/native2ascii.exe">
<arg value="-encoding" />
<arg value="UTF-8" />
<arg value="${basedir}/src/com/mypackage/server/i18n/I18n_de-utf8.properties" />
<arg value="${basedir}/src/com/mypackage/server/i18n/I18n_de.properties" />
</exec>
<exec executable="${java.sdk}/bin/native2ascii.exe">
<arg value="-encoding" />
<arg value="UTF-8" />
<arg value="${basedir}/src/com/mypackage/server/i18n/I18n_en-utf8.properties" />
<arg value="${basedir}/src/com/mypackage/server/i18n/I18n_en.properties" />
</exec>
Blama
Leave a comment: