- java.lang.Object
-
- aeonics.entity.Entity
-
- aeonics.manager.Manager.Type
-
- aeonics.manager.Translator
-
- All Implemented Interfaces:
Exportable
,Snapshotable
public abstract class Translator extends Manager.Type
Manages the translation of text intented for end-users. The availability of any language depends on the implementation, however it is recommended to always provide english ('en') as a fallback.
-
-
Constructor Summary
Constructors Constructor Description Translator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
clear()
Clears all translations in all languagesabstract void
clear(java.lang.String language)
Clears all translations in the specified languagejava.lang.String
get(java.lang.String key)
Gets the translation of the specified key in the default language.abstract java.lang.String
get(java.lang.String key, java.lang.String language)
Gets the translation of the specified key in the specified language.abstract java.lang.String
language()
Returns the current default languageabstract void
language(java.lang.String language)
Sets the default languagejava.lang.Class<? extends Manager.Type>
manager()
Hardcoded manager typevoid
set(Data keys, java.lang.String language)
Sets the translation of the specified keys in the specified language.abstract void
set(java.lang.String key, java.lang.String text, java.lang.String language)
Sets the translation of the specified key in the specified language.-
Methods inherited from class aeonics.manager.Manager.Type
category, internal
-
Methods inherited from class aeonics.entity.Entity
addRelation, addRelation, addRelation, cast, clearRelation, config, defineRelation, equals, export, firstRelation, hashCode, hasRelation, id, name, name, onCreate, onRemove, onUpdate, parameter, relations, relationships, removeRelation, snapshot, type, valueOf, valueOf
-
-
-
-
Method Detail
-
manager
public final java.lang.Class<? extends Manager.Type> manager()
Hardcoded manager type- Specified by:
manager
in classManager.Type
- Returns:
- the type of manager
-
language
public abstract void language(java.lang.String language)
Sets the default language- Parameters:
language
- the ISO-639 (2 letter) language code
-
language
public abstract java.lang.String language()
Returns the current default language- Returns:
- the current default language
-
get
public java.lang.String get(java.lang.String key)
Gets the translation of the specified key in the default language.- Parameters:
key
- the translation key- Returns:
- the translated text
- See Also:
language()
-
get
public abstract java.lang.String get(java.lang.String key, java.lang.String language)
Gets the translation of the specified key in the specified language. The implementation may return the translated value in the default language if the translation does not exist in the specified language.- Parameters:
key
- the translation keylanguage
- the ISO-639 (2 letter) language code- Returns:
- the translated text
-
set
public abstract void set(java.lang.String key, java.lang.String text, java.lang.String language)
Sets the translation of the specified key in the specified language.- Parameters:
key
- the translation keytext
- the translated textlanguage
- the ISO-639 (2 letter) language code
-
set
public void set(Data keys, java.lang.String language)
Sets the translation of the specified keys in the specified language.- Parameters:
keys
- the translated key-value pairslanguage
- the ISO-639 (2 letter) language code
-
clear
public abstract void clear(java.lang.String language)
Clears all translations in the specified language- Parameters:
language
- the ISO-639 (2 letter) language code
-
clear
public abstract void clear()
Clears all translations in all languages
-
-