Click or drag to resize

AbstractPartModuleLocalizeModule Method

A callback which is called when the localization vesion has changed.

Namespace:  KSPDev.PartUtils
Assembly:  KSPDev_Utils.2.5 (in KSPDev_Utils.2.5.dll) Version: 2.5 for KSP v1
Syntax
C#
public virtual void LocalizeModule()
Request Example View Source

Implements

IsLocalizableModuleLocalizeModule
Remarks

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.

Examples
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();
  }
}
See Also