IsLocalizableModuleLocalizeModule Method |
Namespace: KSPDev.GUIUtils
This method can be called before the module is fully initialized! A very common use-case is calling this method from the part module OnAwake() method.
Unless the implementing class is sealed, the method must be declared as virtual. The descendants may want to react on the callback as well.
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(); } }