Skip to content

Language file structure

oddlama edited this page Jun 17, 2021 · 1 revision

Language file structure

  • All language files are yaml files and support the usual yaml syntax. They mostly contain translations simple key-value pairs. This means for each unique message there is something like:
    some_message: "Message"
  • Color codes can be included in the message in the form of §X where X is a code as listed in Formatting Codes
  • The english language file lang-en.yml contains comments for each string, describing when it is used and what parameters are available (parameters are variables in the string for dynamic information like a player name). Never use %s without the numbers to identify the exact argument. Doing it this way allows translations to freely reorder the variables in the message to better form natural sentences.
    # This is the format for player chat messages
    # %1$s: player name
    # %2$s: message
    player_chat_format: "%1$s§7: %2$s"
  • Arguments cannot be colored due to limitations in minecraft's resource pack format, and therefore are always colored by the plugin, independently of the translation file.
  • All language files other than the english default shouldn't contain these comments (to reduce redundancy and prevent misinformation in future updates)
  • Item names and their lore are grouped under the translation key of the item:
      # The item used to show the current target when the target is locked.
      # %1$s: The currently selected target
      select_target_locked:
        name: "§d§lSelect Target"
        lore:
          - ""
          - "§7Current: %1$s"
          - "§8Target selection is currently §6§lLOCKED§r§8!"
  • The initial empty string "" in the lore is used to separate the item from the lore with a blank line.
  • Item lore translations (the lists that are named lore:) MUST have exactly the same amount of lines in every translation file, because Minecraft doesn't allow any newlines in translated strings. So you must try to fit your translation to the amount of lines that are available. This might take some getting used to, but it unfortunately is necessary until mojang allows this. Be careful not to write too much, otherwise the content might overflow outside of the screen area.