Class Localization

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

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

Copyright (c) 2013-2019 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:
Serialized Form
  • Constructor Details

    • Localization

      public Localization​(String prefix)
      Create a Localization object.
      Parameters:
      prefix - String; the prefix of the properties files to use.
  • Method Details

    • getString

      public final String getString​(String key)
      Retrieve a string from a locale bundle. If retrieval fails the value of key string, surrounded by exclamation marks is returned.
      Parameters:
      key - String; the key for the locale in the properties file
      Returns:
      String; localized string, or, if a translation could not be found return the key surrounded by exclamation marks
    • getDefaultString

      public final String getDefaultString​(String key)
      Retrieve a string from the default locale bundle. If retrieval fails the value of key string, surrounded by exclamation marks is returned.
      Parameters:
      key - String; the key for the locale in the properties file
      Returns:
      String; localized string, or, if a translation could not be found return the key surrounded by exclamation marks
    • isDefault

      public boolean isDefault()
      Return whether the current locale is the default (English) locale.
      Returns:
      boolean; true if the current locale is the default; false if the current locale is not the default
    • toString

      public String toString()
      Overrides:
      toString in class Object