ResourceBundle
classin packageklyn.i18n
public abstract class ResourceBundle
ResourceBundle

Locale-specific resources with inherited-key lookup and cached loading. load("messages.Labels", Locale.FRANCE) searches classes before .properties files, from Labels_fr_FR to Labels_fr and Labels. If no localized candidate exists, the default locale is tried before the root. Only the language/country dimensions represented by Locale are considered. Roots follow ClassLoader search order; custom loaders can override resource lookup. Locale scripts and variants are not represented by Locale. Cached bundles are shared; subclasses must support concurrent reads and must not mutate published resource contents.

Example
import klyn.i18n
messages = ResourceBundle.load("messages.Labels", Locale.FRANCE)
print(messages.getString("save"))
print(messages["save"])
print(messages.locale, messages.baseName)
Properties
Modifier and Type Member Description
public readonly property baseName
baseName as String
Family name supplied to load(), without locale suffix or extension.
public readonly property keys
keys as Set<String>
Unique local and inherited keys in unspecified order.
public readonly property locale
locale as Locale
Returns the locale actually loaded, not necessarily the requested locale.
Constructors
Modifier and Type Member Description
public ResourceBundle Creates the base of a resource-bundle subclass.
Methods
Modifier and Type Member Description
public static clearCache
clearCache(loader as ClassLoader = null) as Void
Invalidates cached bundles for a loader, or every loader when omitted.
public containsKey
containsKey(notnull key as String) as Boolean
Tests for a key in this bundle or its parents without throwing if absent.
public getString
getString(notnull key as String) as String
Reads a String resource without converting objects of other types.
public getStringArray
getStringArray(notnull key as String) as String[]
Reads a fixed-size String array without coercing lists or other values.
public static load
load(notnull baseName as String, notnull locale as Locale = Locale.default, notnull loader as ClassLoader = ClassLoader.system) as ResourceBundle
Loads and caches a resource family from the active class path.
Operators
Modifier and Type Member Description
public operator[](notnull key as String) as Object Obtains an object, searching the parent chain only when locally absent.