Package org.djunits.locale
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-2020 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 Summary
Constructors Constructor Description Localization(String prefix)
Create a Localization object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDefaultString(String key)
Retrieve a string from the default locale bundle.String
getString(String key)
Retrieve a string from a locale bundle.boolean
isDefault()
Return whether the current locale is the default (English) locale.String
toString()
-
-
-
Constructor Detail
-
Localization
public Localization(String prefix)
Create a Localization object.- Parameters:
prefix
- String; the prefix of the properties files to use.
-
-
Method Detail
-
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
-
-