IDT - the type of the technical identifier associated to this entity.public abstract class AbstractTranslatableEntity<IDT extends Serializable> extends AbstractEntity<IDT> implements ITranslatableEntity<IDT>
id| Constructor and Description |
|---|
AbstractTranslatableEntity() |
| Modifier and Type | Method and Description |
|---|---|
void |
applyTranslation(String languageCode)
Apply an existing translation on this translatable entity.
|
void |
deleteTranslation(String languageCode)
Deletes an existing translation from this translatable entity.
|
void |
deleteTranslations(List<String> languageCodes)
Function used to delete one or multiple existing translations from the entity.
|
String |
getDefaultLanguageCode()
Gets the language code which was used when the entity was created.
|
ITranslation |
getTranslation(String languageCode)
Gets a translation (corresponding to a specified language code) for the entity.
|
String |
getTranslationLanguageCode()
Gets the language code associated to translations which have been applied to the entity.
|
Map<String,ITranslation> |
getTranslations()
Gets multiple translations in multiple languages for this translatable entity.
|
Boolean |
isTranslated()
Function used to indicate if the entity has been translated of if its fields are in its default
language.
|
void |
setDefaultLanguageCode(String defaultLanguageCode)
Sets the language code which was used when the entity was created.
|
void |
setTranslation(ITranslation translation)
Adds a new translation or update an existing one for the entity.
|
void |
setTranslationLanguageCode(String translationLanguageCode)
Sets the language code associated to the translations which have been applied to the entity.
|
void |
setTranslations(Map<String,ITranslation> translations)
Sets multiple translations in multiple languages for this translatable entity.
|
get, getId, set, setIdpublic void applyTranslation(String languageCode)
applyTranslation in interface ITranslatableEntity<IDT extends Serializable>languageCode - The code of the targeted language translation.public void deleteTranslation(String languageCode)
WARNING: The provided language code is not case sensitive, but, internally the language code which is used and stored is ALWAYS converted in uppercase.
deleteTranslation in interface ITranslatableEntity<IDT extends Serializable>languageCode - The code of the language for which one to delete a translation.public void deleteTranslations(List<String> languageCodes)
WARNING: The provided language codes are not case sensitive, but, internally the language codes which are used and stored are ALWAYS converted in uppercase.
deleteTranslations in interface ITranslatableEntity<IDT extends Serializable>languageCodes - An array with language codes associated to translations to be deleted, if
this parameter is `null` then all the translations are deleted.public String getDefaultLanguageCode()
WARNING: The language code returned by this function is always expressed in uppercase even if you provided a language code to the entity using a lower case syntax. Internally translatable entities always store language codes in upper case.
getDefaultLanguageCode in interface ITranslatableEntity<IDT extends Serializable>public ITranslation getTranslation(String languageCode)
WARNING: The provided language code is not case sensitive, but, internally the language code which is used and stored is ALWAYS converted in uppercase.
getTranslation in interface ITranslatableEntity<IDT extends Serializable>languageCode - The language code for which one to get a translation.public String getTranslationLanguageCode()
The translation language code should only be used when you have to translate an entity in one language to display informations on a GUI (also in one language). If you have to create a GUI for persons responsible of the translations (i.e the translators) then you'll need to attach all the available translations in all languages to you entities. In this cas you should used the `getTranslations()` and `setTranslations()` functions to manage a list of all the translations in all languages attached to the entity. WARNING: The provided language code is not case sensitive, but, internally the language code which is used and stored is ALWAYS converted in uppercase.
getTranslationLanguageCode in interface ITranslatableEntity<IDT extends Serializable>public Map<String,ITranslation> getTranslations()
If you have to display an entity in only one language then do not use the `getTranslations()` and `setTranslations()` function but prefer the `getTranslationLanguageCode()` and `setTranslationLanguageCode()` functions which are used to manage only one translation (i.e in only one language), that's to say to translate the entity in one target language only.
getTranslations in interface ITranslatableEntity<IDT extends Serializable>public Boolean isTranslated()
isTranslated in interface ITranslatableEntity<IDT extends Serializable>public void setDefaultLanguageCode(String defaultLanguageCode)
WARNING: The provided language code is not case sensitive, but, internally the language code which is used and stored is ALWAYS converted in uppercase.
setDefaultLanguageCode in interface ITranslatableEntity<IDT extends Serializable>defaultLanguageCode - The default language code to set, this string must be compliant with
the ISO639-1 standard.public void setTranslationLanguageCode(String translationLanguageCode)
The translation language code should only be used when you have to translate an entity in one language to display informations on a GUI (also in one language). If you have to create a GUI for persons responsible of the translations (i.e the translators) then you'll need to attach all the available translations in all languages to you entities. In this cas you should used the `getTranslations()` and `setTranslations()` functions to manage a list of all the translations in all languages attached to the entity. WARNING: The provided language code is not case sensitive, but, internally the language code which is used and stored is ALWAYS converted in uppercase.
setTranslationLanguageCode in interface ITranslatableEntity<IDT extends Serializable>translationLanguageCode - The translation language code to set, this string must be
compliant with the ISO639-1 standard.public void setTranslation(ITranslation translation)
setTranslation in interface ITranslatableEntity<IDT extends Serializable>translation - The new translation to add or an existing translation to update.public void setTranslations(Map<String,ITranslation> translations)
If you have to display an entity in only one language then do not use the `getTranslations()` and `setTranslations()` function but prefer the `getTranslationLanguageCode()` and `setTranslationLanguageCode()` functions which are used to manage only one translation (i.e in only one language), that's to say to translate the entity in one target language only.
setTranslations in interface ITranslatableEntity<IDT extends Serializable>translations - The translations to set.Copyright © 2017 GOMOOB. All rights reserved.