Package org.nuiton.i18n.bundle
Class I18nBundleEntry
java.lang.Object
org.nuiton.i18n.bundle.I18nBundleEntry
- All Implemented Interfaces:
Comparable<I18nBundleEntry>
A class to represent an entry in a bundle.
The object matches exactly one resource file in a given scope.
The object has three properties :
-
path: the path to resource file where to find transaltion for the entry. -
locale: the locale of the entry - {link #scope} ; the scope of the entry
path.
This object is Comparable, the order relation is defined like this :
- sort first on
scope, in the scope order (seeI18nBundleScope), - if scopes are equals, sort on
localestring representation.
- Author:
- Tony Chemit - chemit@codelutin.com
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionI18nBundleEntry(URL path, Locale locale, I18nBundleScope scope) Constructor if an bundle entry. -
Method Summary
Modifier and TypeMethodDescriptionintbooleangetPath()getScope()inthashCode()voidload(Properties resource) Deprecated.voidload(Properties resource, Charset encoding) For a given language, load the resource file of this entry into theresourceproperties object.booleanmatchLocale(Locale locale, I18nBundleScope scope) Method to match or not a bundle entry for a given scope and locale.toString()
-
Field Details
-
path
path to resource file -
locale
local of the entry, can be null if general scope -
scope
scope of the entry
-
-
Constructor Details
-
I18nBundleEntry
Constructor if an bundle entry. It is defined by apathof the resource file, a scope and a locale.- Parameters:
path- the path of the resource file fo the bundle entrylocale- the given locale of the bundle entryscope- the scope of the given entry
-
-
Method Details
-
getPath
-
getLocale
-
getScope
-
matchLocale
Method to match or not a bundle entry for a given scope and locale. We use the inclusive property of scope, means that we accept all entries on the path to the generalest entry for a givne locale.- Parameters:
locale- the locale to matchscope- the highest scope to match- Returns:
trueif the entry match the scope and locale *
-
load
Deprecated.since 2.4 useload(Properties, Charset)instead, charset must be provided to avoid encoding problemsFor a given language, load the resource file of this entry into theresourceproperties object.- Parameters:
resource- the save of resources already loaded- Throws:
IOException- if any pb while reading resource file
-
load
For a given language, load the resource file of this entry into theresourceproperties object. Usecharsetto load properties. It could be different from resulting properties store.- Parameters:
resource- the save of resources already loadedencoding- Charset used to store the properties- Throws:
IOException- if any pb while reading resource file- Since:
- 2.4
-
compareTo
- Specified by:
compareToin interfaceComparable<I18nBundleEntry>
-
equals
-
hashCode
public int hashCode() -
toString
-
load(Properties, Charset)instead, charset must be provided to avoid encoding problems