-
Notifications
You must be signed in to change notification settings - Fork 7
Examples
Here are some practical ways to use IGLanguages on your server!
Make your players feel at home by welcoming them in their own language.
Step 1: Define messages
In langs/en_us/messages.yml:
welcome: "&eWelcome &f%player_name% &eto the server!"In langs/pt_br/messages.yml:
welcome: "&eBem-vindo &f%player_name% &eao servidor!"Step 2: Use the placeholder Since these are in the root folder, use the key directly:
%lang_welcome%
Make your scoreboard multilingual using PlaceholderAPI!
In langs/en_us/systems/board.yml:
title: "&bMy Server"
money: "Money"In langs/pt_br/systems/board.yml:
title: "&aMeu Servidor"
money: "Dinheiro"In your Scoreboard Config:
Use the folder.filename_key namespace:
Title: "%lang_systems.board_title%"
Lines:
- "%lang_systems.board_money%: %vault_eco_balance%"If you use DeluxeMenus, you can create fully translated GUIs.
In langs/en_us/menus/main.yml:
title: "Server Menu"
shop: "Shop"In DeluxeMenus/config.yml:
gui_menus:
main_menu:
menu_title: "%lang_menus.main_title%"
items:
'shop':
display_name: "%lang_menus.main_shop%"Pass dynamic values directly into your translations using {0}, {1}, etc. This lets you reuse the same translation template with different arguments β no need to create a separate key for every variant!
Syntax: %lang_<key>:<arg0>,<arg1>,...%
In langs/en_us/menus/lobby.yml:
server_name: "β Lobby {0}"
server_lore:
- " β Connected: {0}"
- " β Max Capacity: {1}"Usage in any plugin config (DeluxeMenus, scoreboard, etc.):
display_name: "%lang_menus.lobby_server_name:#01%"
lore:
- "%lang_menus.lobby_server_lore:{server_online},{server_max_players}%"Result:
β Lobby #01
β Connected: 42
β Max Capacity: 100
| Feature | Syntax | Example |
|---|---|---|
| Simple arg |
{0}, {1}, ... |
%lang_key:value% β replaces {0} with value
|
| Multiple args | Comma-separated |
%lang_key:a,b,c% β {0}=a, {1}=b, {2}=c |
| PAPI in args | Bracket placeholders |
%lang_key:{player_name},{server_online}% β resolved automatically |
| Literal comma | Escape with \,
|
%lang_key:hello\, world% β arg = hello, world
|
| Missing arg | Left as-is |
{2} with only 2 args stays as {2}
|
| No args | Works as before |
%lang_key% β fully backward compatible |
Tip: Arguments also work inside nested
%lang_*%placeholders! If a translation contains%lang_other_key:arg%, the inner placeholder is resolved with its own arguments.
Next: Developer-API