Class UnitLocale

java.lang.Object
org.djunits.locale.UnitLocale
All Implemented Interfaces:
Serializable

public class UnitLocale extends Object implements Serializable
Localization object for language specific reporting of units.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License

Author:
Alexander Verbraeck, Peter Knoppers
See Also:
  • Constructor Details

    • UnitLocale

      public UnitLocale(String prefix)
      Create a localization object for units and unit systems. The prefix is right now either "unit" or "unitsystem".
      Parameters:
      prefix - String; the prefix of the properties files to use.
  • Method Details

    • checkReload

      public void checkReload()
      Reload the resource bundle if necessary.
    • getString

      public final String getString(String key)
      Retrieve a string from a resource bundle. If retrieval fails, try the fallbackLocale. If that fails as well, return the value of key string, surrounded by exclamation marks. When the DefaultLocale has changed, load a new ResourceBundle.
      Parameters:
      key - String; the key for the locale in the currently valid resource bundle
      Returns:
      String; localized string, or, if the key could not be found, the key surrounded by exclamation marks
    • getFallbackString

      public final String getFallbackString(String key)
      Retrieve a string from the falback bundle. If retrieval fails, return the value of key string, surrounded by exclamation marks.
      Parameters:
      key - String; the key for the fallback locale to look up in the resource bundle
      Returns:
      String; localized string, or, if the key could not be found, the key surrounded by exclamation marks
    • toString

      public String toString()
      Overrides:
      toString in class Object