Namespace 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.

Functions

  • Adds translations for specified object in several languages.

    Parameters

    • name: string

      default string in English or name key

    • localization: {
          [language: string]: string;
      }

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

      • [language: string]: string

    Returns void

  • Returns string

    Two-letter language code for current game language.

  • 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.

Copyright © 2024 Nernar. Copyright © 2020 #mineprogramming. Built with ❤ and TypeDoc.