-
Notifications
You must be signed in to change notification settings - Fork 0
Localization System
hahasc26-lang edited this page Aug 22, 2026
·
3 revisions
BalancedTeam includes an enterprise-grade, client-aware localization engine that automatically serves messages and GUI titles to players in their preferred language with zero performance impact.
-
Automatic Client Locale Detection: Reads each player's Minecraft client language setting via
Player.getLocale()when they connect. -
Smart Prefix Fuzzy Matching: Intelligently maps regional variations (e.g.
en_GB,en_CA$\to$ en_US;zh_HK,zh_MO$\to$ zh_TW/zh_CN). -
Relative Path & Code Configuration:
config.ymlaccepts language codes (e.g.en_US,zh_CN), file names (e.g.en_US.yml), or relative paths (e.g.lang/en_US.yml,lang/zh_CN.yml). -
Automatic Server Console Log Localization: Server console output logs (startup banner, database initialization, table verification, data preloading, PlaceholderAPI hooking, reload, player join locale detection, and safe shutdown) automatically switch to match the configured language in
config.ymlwithout exposing manual log configurations. -
High-Performance Memory Caching: All language files in
plugins/BalancedTeam/lang/*.ymlare fully pre-cached in memory on startup, ensuring$O(1)$ lookup time and zero disk I/O during gameplay. - Auto-Completion for Missing Keys: If a custom language pack lacks newly introduced keys, the plugin automatically completes missing entries from the default pack and saves them without breaking existing translations.
-
Configurable Time Units: Supports custom day, hour, minute, and second duration labels configured via
time_unitin language files. -
Player Overrides & Persistence: Players can lock their language preference using
/teamlang <code|auto>, which is persisted indata/user_languages.ymlacross logins.
When sending a message or opening a GUI for a player, the localization engine evaluates language selection in this priority:
Player Joins / Requests Message
│
Is Manual Preference Set?
├── YES ──► Use Selected Language Pack
└── NO
│
Read Client Locale (Player.getLocale())
│
Exact Match in lang/*.yml?
├── YES ──► Use Exact Pack (e.g. en_US.yml)
└── NO
│
Fuzzy Match by Prefix (zh_*, en_*)?
├── YES ──► Use Closest Match (e.g. zh_TW.yml)
└── NO
│
Fallback to config.yml Default Language
│
Fallback to Built-in zh_CN.yml (Hard Fallback)
| Language Code | File Name | Display Name |
|---|---|---|
zh_CN |
lang/zh_CN.yml |
简体中文 (Simplified Chinese) |
zh_TW |
lang/zh_TW.yml |
繁體中文 (Traditional Chinese) |
en_US |
lang/en_US.yml |
English (US) |
Adding support for a new language (e.g., Japanese ja_JP, Russian ru_RU, French fr_FR, German de_DE, Spanish es_ES) is straightforward:
- Navigate to
plugins/BalancedTeam/lang/. - Copy
en_US.ymland rename it to your target locale (e.g.,ja_JP.ymlorru_RU.yml). - Set the top-level display name at the start of the file:
language_name: "日本語" # Or "Русский", "Français", "Español", "Deutsch"
- Translate the message strings as desired. All color codes (
&a,&b, etc.) and hex color codes (&#RRGGBBand<#RRGGBB>) are supported. - Run
/teamlang reloador/teamadmin reloadin game to load your new language pack immediately without server restart. - Verify your pack is loaded using
/teamlang list.
-
/teamlang: View active language code, client detection status, and help. -
/teamlang list: Displays all supported language packs loaded on the server. -
/teamlang <code|auto>: Manually switch to a specific pack (e.g./teamlang en_US) or reset to client auto-detection (/teamlang auto). -
/teamlang reload: Hot-reload all language files from disk (Requiresbalancedteam.admin).
| ← Diplomacy & Combat Balance | Next: PlaceholderAPI Reference → |
|---|