Package org.nuiton.i18n
Class I18nLanguage
java.lang.Object
org.nuiton.i18n.I18nLanguage
Represents a language in i18n system with all his translations.
To obtain a translation, use the method
translate(String)- Since:
- 1.1
- Author:
- Tony Chemit - chemit@codelutin.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Localela locale de la langueprotected booleanUsed to know null should be returned when a key is not found.protected StringIndique le chemin du fichier dans lequel ecrire les entrees non trouveesprotected Propertiestoutes les traductions pour cette langue -
Constructor Summary
ConstructorsConstructorDescriptionI18nLanguage(Locale l, boolean missingKeyReturnNull) I18nLanguage(Locale locale, String recordFilePath) I18nLanguage(Locale locale, String recordFilePath, boolean missingKeyReturnNull) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanprotected voidfinalize()inthashCode()booleanvoidload(I18nBundleEntry[] bundleEntries) Deprecated.voidload(I18nBundleEntry[] bundleEntries, Charset encoding) charge les traductions de la languea partir d'une liste donnee de fichiers de traduction.protected voidrecordNotFound(String key) intsize()toString()Translate takes a sentence and returns its translation if found, the very same string otherwise.untranslate(String sentence) Untranslate takes a translated sentence and returns the original one if found, the very same string otherwise.
-
Field Details
-
resource
toutes les traductions pour cette langue -
locale
la locale de la langue -
recordFilePath
Indique le chemin du fichier dans lequel ecrire les entrees non trouvees -
missingKeyReturnNull
protected boolean missingKeyReturnNullUsed to know null should be returned when a key is not found.- Since:
- 2.4.1
-
-
Constructor Details
-
I18nLanguage
-
I18nLanguage
-
I18nLanguage
-
I18nLanguage
-
-
Method Details
-
load
Deprecated.since 2.4 useload(I18nBundleEntry[], Charset)instead, charset must be provided to avoid encoding problemscharge les traductions de la languea partir d'une liste donnee de fichiers de traduction.- Parameters:
bundleEntries- the used bundles entries to load
-
load
charge les traductions de la languea partir d'une liste donnee de fichiers de traduction.- Parameters:
bundleEntries- the used bundles entries to loadencoding- Charset to use for Properties loading- Since:
- 2.4
-
translate
Translate takes a sentence and returns its translation if found, the very same string otherwise.- Parameters:
sentence- sentence to translate- Returns:
- translated sentence
-
recordNotFound
-
untranslate
Untranslate takes a translated sentence and returns the original one if found, the very same string otherwise.- Parameters:
sentence- sentence to untranslate- Returns:
- untranslated sentence
-
getLocale
-
size
public int size() -
close
public void close() -
hasRecord
-
finalize
-
equals
-
hashCode
public int hashCode() -
toString
-
load(I18nBundleEntry[], Charset)instead, charset must be provided to avoid encoding problems