* Router Console translation infrastructure:

- Persistent lang setting with routerconsole.lang=xx
      - Loading any page with ?lang=xx changes the persistent setting
      - Add a custom Jetty handler to load foo_xx.jsp if it
        exists for language xx. This is for jsp files with lots
        of text in them. Otherwise use inline translate methods.
        Not for included jsps.
      - Add a script to create and update messages_xx.po translation
        files, and create ResourceBundles from them
      - Add class to translate strings from cached ResourceBundles
      - Add translate wrappers to HelperBase, FormHandler, and *Renderer,
        so calls can be made from both jsp and java files
      - Add two example translations on configupdate.jsp - one in
        the jsp itself and one in the helper.
      - This is for strings in routerconsole only. Will be expanded
        to other webapps and the router later.
This commit is contained in:
zzz
2009-10-18 14:06:07 +00:00
parent 10b84418c3
commit 4497463778
19 changed files with 311 additions and 6 deletions

View File

@ -62,7 +62,8 @@ public class ContentHelper extends HelperBase {
/**
* Convert file.ext to file_lang.ext if it exists.
* Get lang from either the cgi lang param or from the default locale.
* Get lang from the cgi lang param, then properties, then from the default locale.
* _context must be set to check the property.
*/
private String filename() {
int lastdot = _page.lastIndexOf('.');
@ -70,9 +71,13 @@ public class ContentHelper extends HelperBase {
return _page;
String lang = _lang;
if (lang == null || lang.length() <= 0) {
lang = Locale.getDefault().getLanguage();
if (lang == null || lang.length() <= 0)
return _page;
if (_context != null)
lang = _context.getProperty(Messages.PROP_LANG);
if (lang == null || lang.length() <= 0) {
lang = Locale.getDefault().getLanguage();
if (lang == null || lang.length() <= 0)
return _page;
}
}
if (lang.equals("en"))
return _page;