![]() |
EasyTalk API
|
AutoTranslate is a component which can be placed on a GameObject with a text component. When used with an appropriate TranslationLibrary, it enables the text to be translated automatically whenever the language is changes on the EasyTalkGameState. More...
Inherits MonoBehaviour.
Public Member Functions | |
void | SetText (string text) |
Sets the text value of the text component. The text passed to this method should be in the default/original language and will be translated automatically by this method if possible. | |
Protected Member Functions | |
void | LanguageChanged (string oldLanguage, string newLanguage) |
Called whenever the language is changed on the EasyTalkGameState. This method will attempt to update the text to the translated version and update the font of the text element if necessary. | |
Properties | |
Text | Text [get] |
Private Member Functions | |
void | Awake () |
INitializes the AutoTranslate component. | |
void | OnDestroy () |
Unregister the LanguageChanged method frm the onLanguageChanged delegate so that the EasyTalkGameState instance will no longer try to call this object. | |
void | UpdateFont () |
Updates the font of the text element to a font compatible with the current language (based on the language font overrides of the EasyTalkGameState). | |
void | UpdateText () |
Updates the text element to a translated version of the original text if a translation can be found for the current EasyTalkGameState language. | |
Private Attributes | |
Text | text |
The text component to translate. | |
TranslationLibrary | library |
The translation library to use for translations. | |
LanguageFontOverrides | languageFontOverrides |
The set of fonts to use for various languages. | |
string | originalText |
The original text value. | |
AutoTranslate is a component which can be placed on a GameObject with a text component. When used with an appropriate TranslationLibrary, it enables the text to be translated automatically whenever the language is changes on the EasyTalkGameState.
|
private |
INitializes the AutoTranslate component.
|
protected |
Called whenever the language is changed on the EasyTalkGameState. This method will attempt to update the text to the translated version and update the font of the text element if necessary.
oldLanguage | The prior language being used. |
newLanguage | The new language to use. |
|
private |
Unregister the LanguageChanged method frm the onLanguageChanged delegate so that the EasyTalkGameState instance will no longer try to call this object.
void EasyTalk.Localization.AutoTranslate.SetText | ( | string | text | ) |
Sets the text value of the text component. The text passed to this method should be in the default/original language and will be translated automatically by this method if possible.
text | The new text value. |
|
private |
Updates the font of the text element to a font compatible with the current language (based on the language font overrides of the EasyTalkGameState).
|
private |
Updates the text element to a translated version of the original text if a translation can be found for the current EasyTalkGameState language.
|
private |
The set of fonts to use for various languages.
|
private |
The translation library to use for translations.
|
private |
The original text value.
|
private |
The text component to translate.
|
get |