Class PoResourceBundle

java.lang.Object
java.util.ResourceBundle
ch.autumo.ui.utils.PoResourceBundle

public final class PoResourceBundle extends ResourceBundle
Merged gettext ResourceBundle.

All texts of autumo-ui and of the running application are gettext PO catalogues, lang/messages.<lang>.po below a base resource path. This bundle merges the catalogues of the given base resource paths in the order they are passed — the first catalogue wins — so an application only has to ship the PO files of its own texts and everything else comes from the autumo-ui framework (/ch/autumo/ui/lang/messages.<lang>.po). An application may nevertheless override any framework text by defining its key.

The PO files are parsed once per instance; autumo-ui caches the bundle per base resource path and language (Helper.getMessageBundle(String)) and clears the cache on a language change (Helper.setLanguage(String)). Because handleGetObject(String) returns null for an unknown key, callers can apply their own fallback (see Helper.getText(ch.autumo.ui.fx.BaseApp, String, String)) or simply show the message id.

  • Constructor Details

    • PoResourceBundle

      public PoResourceBundle(String lang, String... baseResourcePaths)
      Creates a bundle from the PO catalogues of the given base resource paths.
      Parameters:
      lang - language code, e.g. en or de
      baseResourcePaths - base resource paths in descending priority, e.g. '/ch/autumo/app/' and '/ch/autumo/ui/'
  • Method Details