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.
|
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.
|
|
|
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.
|
|
|
void | Awake () |
| INitializes the AutoTranslate component.
|
|
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.
|
|
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.
◆ Awake()
void EasyTalk.Localization.AutoTranslate.Awake |
( |
| ) |
|
|
private |
INitializes the AutoTranslate component.
◆ LanguageChanged()
void EasyTalk.Localization.AutoTranslate.LanguageChanged |
( |
string | oldLanguage, |
|
|
string | newLanguage ) |
|
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.
- Parameters
-
oldLanguage | The prior language being used. |
newLanguage | The new language to use. |
◆ SetText()
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.
- Parameters
-
◆ UpdateFont()
void EasyTalk.Localization.AutoTranslate.UpdateFont |
( |
| ) |
|
|
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).
◆ UpdateText()
void EasyTalk.Localization.AutoTranslate.UpdateText |
( |
| ) |
|
|
private |
Updates the text element to a translated version of the original text if a translation can be found for the current EasyTalkGameState language.
◆ languageFontOverrides
The set of fonts to use for various languages.
◆ library
The translation library to use for translations.
◆ originalText
string EasyTalk.Localization.AutoTranslate.originalText |
|
private |
◆ text
Text EasyTalk.Localization.AutoTranslate.text |
|
private |
The text component to translate.
◆ Text
Text EasyTalk.Localization.AutoTranslate.Text |
|
get |