LocalizableItemAttribute Class |
Namespace: KSPDev.GUIUtils
[AttributeUsageAttribute(AttributeTargets.Method|AttributeTargets.Field, AllowMultiple = true)] public class LocalizableItemAttribute : Attribute
The LocalizableItemAttribute type exposes the following members.
Name | Description | |
---|---|---|
LocalizableItemAttribute | Initializes a new instance of the LocalizableItemAttribute class |
Name | Description | |
---|---|---|
GetLocalizedString | Returns the localized string. |
Name | Description | |
---|---|---|
defaultTemplate | Template to use if no localized template found. | |
description | Description for the message. | |
spec |
A key to distinguish attributes when there are multiple of them attached to a member.
| |
tag | Tag to use when resolving the string via the Localizer. |
Use this attribute to automatically localize the part's events, fields, and actions. The relevant strings will be loaded when the vessel or part is either created or loaded. The strings will also properly update when reloading the language definitiaion via LocalizationTool.
See the "seealso" section for the types and methods that are aware of this attribute.
[KSPField(guiName = "just-in-case text", guiActive = true)] [LocalizableItem( tag = "#tag1", defaultTemplate = "English text 1", description = "A field which demonstrates a localizable GUI string")] public string field1 = ""; // This field doesn't have guiName and it would, normally, be treated as a non-GUI field. However, // due to the localization attribute, the guiName value will be assigned when the module is // loaded. [KSPField(guiActive = true)] [LocalizableItem( tag = "#tag2", defaultTemplate = "English text 2", description = "A field which demonstrates a localizable GUI string without guiName")] public string field2 = "";
[KSPEvent(guiName = "just-in-case text", guiActive = true)] [LocalizableItem( tag = "#tag1", defaultTemplate = "English text", description = "A field which demonstrates a localizable event")] public void MyEvent1() { Debug.Log("MyEvent1 invoked"); }
[KSPEvent(guiName = "just-in-case text", guiActive = true)] [LocalizableItem( tag = "#tag1", defaultTemplate = "English text", description = "A field which demonstrates a localizable action")] public void MyAction1() { Debug.Log("MyAction1 invoked"); }