Class WStdLocalizedStrings

java.lang.Object
eu.webtoolkit.jwt.WLocalizedStrings
eu.webtoolkit.jwt.WStdLocalizedStrings

public class WStdLocalizedStrings
extends WLocalizedStrings
A localized strings implementation that uses ResourceBundle resource bundles.

This localized strings class will translate localized WString strings in the WApplication.getLocale() based on their WString.getKey().

When a key cannot be found (not in the locale specific or default bundle), the translated string will be "??key??".

See Also:
WApplication.setLocalizedStrings(WLocalizedStrings)
  • Constructor Summary

    Constructors
    Constructor Description
    WStdLocalizedStrings()
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    boolean containsXML()
    Returns whether this contains only valid XML.
    void refresh()
    Rereads the message resources.
    java.lang.String resolveKey​(java.lang.String key)
    Resolves a key in the current locale.
    void setContainsXML​(boolean containsXML)
    Sets whether this resource bundle contains only valid XML.
    void use​(java.lang.String bundleName)
    Set the bundle name.

    Methods inherited from class eu.webtoolkit.jwt.WLocalizedStrings

    hibernate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WStdLocalizedStrings

      public WStdLocalizedStrings()
      Constructor.
  • Method Details

    • use

      public void use​(java.lang.String bundleName)
      Set the bundle name. The argument will be passed to ResourceBundle.getBundle(String).
      Parameters:
      bundleName -
    • refresh

      public void refresh()
      Description copied from class: WLocalizedStrings
      Rereads the message resources.

      Purge any cached key/values, if applicable.

      The default implementation does nothing.

      Overrides:
      refresh in class WLocalizedStrings
    • resolveKey

      public java.lang.String resolveKey​(java.lang.String key)
      Description copied from class: WLocalizedStrings
      Resolves a key in the current locale.

      This method is used by WString to obtain the UTF8 value corresponding to a key in the current locale.

      Returns the value if the key could be resolved. Returns null otherwise.

      Specified by:
      resolveKey in class WLocalizedStrings
      See Also:
      WApplication.getLocale(), WString.tr(String key)
    • containsXML

      public boolean containsXML()
      Returns whether this contains only valid XML. Values that are being returned will be checked to be valid XML (text).
    • setContainsXML

      public void setContainsXML​(boolean containsXML)
      Sets whether this resource bundle contains only valid XML.
      Parameters:
      containsXML -
      See Also:
      containsXML()