Package org.djunits.locale
Class UnitLocale
java.lang.Object
org.djunits.locale.UnitLocale
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionUnitLocale
(String prefix) Create a localization object for units and unit systems. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Reload the resource bundle if necessary.final String
getFallbackString
(String key) Retrieve a string from the falback bundle.final String
Retrieve a string from a resource bundle.toString()
-
Constructor Details
-
UnitLocale
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
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
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
-