Package org.nuiton.i18n
Class I18nStore
java.lang.Object
org.nuiton.i18n.I18nStore
Represents the store of languages of the i18n system.
Replace the
org.nuiton.i18n.I18nLoader class from project
http://maven-site.nuiton.org/nuiton-utils- Since:
- 1.1
- Author:
- Tony Chemit - chemit@codelutin.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected I18nBundle[]le cache de bundles deja chargesprotected Localela locale par defaut a utiliser.protected I18nLanguagele language actuellement utiliseprotected Map<Locale, I18nLanguage> le cache de languages deja chargesprotected I18nInitializerle resolver de bundles -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected I18nLanguageaddLanguage(Locale locale) protected voidprotected voidclose()Close store and release cache ofg language.getBundles(Locale l) Obtain the current language setted in the store.Obtain the current locale setted in the store.Deprecated.protected I18nLanguagegetLanguage(Locale locale) Recherche un object de typeI18nLanguagepour la locale donnée en paramètre dans le cache des langues chargées (languages).protected Map<Locale, I18nLanguage> Locale[]protected voidinit()booleanisEmpty()protected booleanisInit()voidsetCurrentLocale(Locale locale) Sets the current locale for the store.protected voidsetLanguage(Locale locale) Deprecated.since 2.1, will be removed in version 3.0, use now the methodsetCurrentLocale(Locale).
-
Field Details
-
language
le language actuellement utilise -
languages
le cache de languages deja charges -
bundles
le cache de bundles deja charges -
defaultLocale
la locale par defaut a utiliser. -
resolver
le resolver de bundles
-
-
Constructor Details
-
I18nStore
- Parameters:
defaultLocale- default localeresolver- resolver of bundles
-
-
Method Details
-
getCurrentLanguage
Obtain the current language setted in the store. This language is used for all translations without locale information (says the methodI18n.t(String, Object...)).- Returns:
- the current language or
nullif none is defined - Since:
- 2.1
-
getCurrentLocale
Obtain the current locale setted in the store. This locale is coming from the current language and is used for all translations without locale information (says the methodI18n.t(String, Object...).- Returns:
- the current locale or
nullif no current language is setted - Since:
- 2.1
-
setCurrentLocale
Sets the current locale for the store. This will set the current language with this given locale.- Parameters:
locale- the new current locale- Since:
- 2.1
-
getLanguage
Deprecated.since 2.1, will be removed in version 3.0, prefer use now the methodgetCurrentLanguage().- Returns:
- current language loaded or null, if no language was load.
-
getLanguages
- Returns:
- le cache de language actuellement pris en charge.
-
getDefaultLocale
- Returns:
- the default locale of the store
-
isEmpty
public boolean isEmpty() -
getLocales
- Returns:
- array of all locales loaded
-
getBundles
-
getBundles
-
getBundleEntries
-
getBundleEntries
-
init
protected void init() -
setLanguage
Deprecated.since 2.1, will be removed in version 3.0, use now the methodsetCurrentLocale(Locale).Set a new language in store, given a locale.- Parameters:
locale- la locale du language requis
-
close
protected void close()Close store and release cache ofg language. Current language will be also cleaned. -
getLanguagesCache
- Returns:
- le cache de language avec instanciation paresseuse
-
getLanguage
Recherche un object de typeI18nLanguagepour la locale donnée en paramètre dans le cache des langues chargées (languages). Si un tel objet n'existe pas, alors on en crée un et on le place dans le cache.- Parameters:
locale- la locale du language recherche- Returns:
- le language trouve dans le cache.
-
addLanguage
-
isInit
protected boolean isInit() -
checkInit
protected void checkInit() -
getResolver
-
getCurrentLanguage().