LocalizationLoader Class |
Namespace: KSPDev.GUIUtils
The LocalizationLoader type exposes the following members.
Name | Description | |
---|---|---|
LocalizationLoader | Initializes a new instance of the LocalizationLoader class |
Name | Description | |
---|---|---|
LoadItemsInModule | Localizes the PartModule items. |
It also monitors if the localization version has changed. If this is the case, then all the localizable modules will be notified.
This module is initialized from the KSPDev Utils loader.
public class LocalizationLoaderDemo1 : PartModule { public class OtherModule : PartModule { [KSPField(guiName = "just-in-case text", guiActive = true)] [LocalizableItem(tag = "#tag1")] public string field1 = ""; } public void AddCustomModule() { var newModule = gameObject.AddComponent<OtherModule>(); LocalizationLoader.LoadItemsInModule(newModule); } }
public class LocalizationLoaderDemo2 : PartModule, IsLocalizableModule { [KSPField(guiActive = true)] [LocalizableItem(tag = "#tag1", defaultTemplate = "Field1")] [LocalizableItem(tag = "#tag2", defaultTemplate = "units", spec = StdSpecTags.Units)] public string field1 = ""; - #region IsLocalizableModule implementation public void LocalizeModule() { LocalizationLoader.LoadItemsInModule(this); } #endregion public override void OnAwake() { base.OnAwake(); LocalizeModule(); } }