pluginiPlugin

Internationalization Language

Display corresponding content based on client language

Effect

Through internationalization language configuration, the Xerr plugin can automatically load text content in the corresponding language according to the player's client language settings. For example:

Players using an English client will see English prompt text (e.g., "Scroll to select reply") Players using a Traditional Chinese client will see Traditional Chinese text (e.g., "滾輪切換回復選項")

1

Directory Structure

Internationalization language configuration files adopt a directory structure corresponding to the original layout/display files for easy maintenance and mapping.

The core directory is core/lang, which contains two types of translation files: layout display and line display:

  • Language code specification: Refer to the Minecraft Wiki language code standards (e.g., en_US for English, zh_CN for Simplified Chinese)
  • Directory mapping rules: core/lang/layout corresponds to translations for the core/layout directory, and core/lang/display/line corresponds to translations for the core/display/bossbar/line directory

Layout Display Translation

core/lang/layout/en_US.yml
# Must be layout
layout:
  # Layout ID
  hud_1:
    # Element ID
    currency_text:
      # Corresponding value
      value: "  Money: %vault_eco_balance%  "
  session:
    scroll_tip:
      value: "Scroll to select reply"

Corresponding original layout file The value in the original layout file is the default text, which will be overwritten by the translation file of the corresponding language during internationalization:

core/layout/hud_info.yml
hud_1:
  currency_text:
    position: LEFT_TOP
    x: 20
    y: -37
    value: "  经济:%vault_eco_balance%  "
    background:
      id: background_1
      x: 10
      y: -27
core/layout/session.yml
session:
  ui:
    position: CENTER_BOTTOM
    x: -128
    y: 26
    image:
      id: ui
  scroll_tip:
    position: CENTER_BOTTOM
    x: 61
    y: 7
    value: "滚轮切换回复选项"

Line Display Translation

core/lang/display/line/en_US.yml
# Must be line
line:
  # Line ID
  bar_2:
    # Element ID
    notice:
      # Corresponding text
      text: >-
        &r       &r
        {{
          set number to random2 1 to 3
          case &number [
              when 1 -> "Welcome to the Xerr plugin"
              when 2 -> "Specializing in Minecraft vanilla text graphics"
              else "Hello World"
          ]
        }}
        &r  &r

Corresponding original display file The text in the original display file is the default text, which will be overwritten by the translation file of the corresponding language during internationalization:

core/display/bossbar/line/example.yml
bar_2:
  line:
    notice:
      # Display condition
      condition: |
        perm xerr.notice
      refresh: 40
      text: >-
        &r       &r
        {{
          set number to random2 1 to 3
          case &number [
              when 1 -> "欢迎使用 Xerr 插件"
              when 2 -> "专注于 Minecraft 原版字体图形"
              when 3 -> "¥ 150 限时特惠"
              else "Hello World"
          ]
        }}
        &r  &r
      x: -26
      y: -1
      background:
        id: background_1
        y: 12

On this page