Class PhrasedComponentLocalizer<LT, CT>
Base class for component localizers that depend on a phrase. UI texts are a good example. Override UpdatePhrasedComponent() instead of UpdateComponent() when inheriting this class. phrase property indicates the phrase to translate. _translation field is the translated phrase in current language. Use it when updating the component.
Inherited Members
Namespace: NoSuchStudio.Localization
Assembly: NoSuchStudio-Localization.dll
Syntax
public abstract class PhrasedComponentLocalizer<LT, CT> : ComponentLocalizer<LT, CT>, ILocalizationServiceComponent, IServiceComponent<LocalizationService> where LT : PhrasedComponentLocalizer<LT, CT> where CT : Component
Type Parameters
| Name | Description |
|---|---|
| LT | The component that inherits ComponentLocalizer. |
| CT | The component that is localized by LT. |
Remarks
For example, a LT component that localizes a text would have LT = LT and CT = Text.
Fields
_phrase
The phrase for this localized component.
Declaration
[SerializeField]
protected string _phrase
Field Value
| Type | Description |
|---|---|
| String |
_translation
Declaration
[NonSerialized]
protected string _translation
Field Value
| Type | Description |
|---|---|
| String |
Properties
phrase
Declaration
public string phrase { get; set; }
Property Value
| Type | Description |
|---|---|
| String |
Methods
OnTranslationChange(String, Locale, String)
Declaration
protected virtual void OnTranslationChange(string phrase, Locale locale, string translation)
Parameters
| Type | Name | Description |
|---|---|---|
| String | phrase | |
| Locale | locale | |
| String | translation |
OnValidate()
Declaration
protected override void OnValidate()
Overrides
NoSuchStudio.Localization.ComponentLocalizer<LT, CT>.OnValidate()
RegisterToLocalization()
Declaration
protected override void RegisterToLocalization()
Overrides
NoSuchStudio.Localization.ComponentLocalizer<LT, CT>.RegisterToLocalization()
UnregisterFromLocalization()
Declaration
protected override void UnregisterFromLocalization()
Overrides
NoSuchStudio.Localization.ComponentLocalizer<LT, CT>.UnregisterFromLocalization()
UpdateComponent()
Declaration
public override sealed void UpdateComponent()
Overrides
NoSuchStudio.Localization.ComponentLocalizer<LT, CT>.UpdateComponent()
UpdatePhrasedComponent()
Declaration
public abstract void UpdatePhrasedComponent()
Implements
IServiceComponent<>