Перейти к основному содержанию

Translation

Module that can be used to localize mods. All default strings (e.g. item names, windows titles, etc.) in the mod should be in English. Add translations to these strings using Translation.addTranslation. For items and blocks translations are applied automatically. For the other strings, use Translation.translate.

Index

Functions

addTranslation

  • addTranslation(name: string, localization: {}): void
  • Adds translations for specified object in several languages.


    Parameters

    • name: string

      default string in English or name key

    • localization: {}

      object containing two-letter language codes as keys and localized strings in the specified language as values

      Returns void

    getLanguage

    • getLanguage(): string

    • Returns string

      Two-letter language code for current game language.

    translate

    • translate(name: string): string
    • Translates string from English to current game language (if available). Add translations via Translation.addTranslation to apply them.


      Parameters

      • name: string

        default string in English or name key

      Returns string

      String in the current game language or input string if translation is not available.

    Page Options