Click or drag to resize

IsLocalizableModuleLocalizeModule Method

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

Namespace:  KSPDev.GUIUtils
Assembly:  KSPDev_Utils.2.0 (in KSPDev_Utils.2.0.dll) Version: 2.0 for KSP v1.8+
Syntax
C#
void LocalizeModule()
Request Example View Source
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