Languages
Module info | |
---|---|
Configuration | languages in config.yml |
Manager | LanguageManager |
Support | 1.8+ |
Free version | ✔ |
Proxy-configurable | ❌ |
One of the plugin's most interesting features is the multi languages support. You can create as many languages as you want; players will be able to change theirs with just a command. This module translates every line of text sent to the player if the translation is present, otherwise it will default to the main language's one, which is always present.
If you are running a multiple server setup (proxy) you have to configure the feature on every instance under your network; languages are not handled by the proxy.
Setup
The following snippet of code represents and explains the languages' configuration.
# ...storage's settings...
languages:
main-language-id: english # default language's ID
detector:
enabled: false # whether to enable the language detector
method: CLIENT_LOCALE # read below
delay-ms: 5000 # delay to wait before detecting the language, in milliseconds
command:
cooldown: 5m # cooldown to wait between language changes
commands: [] # read below
english: # main language's ID
display-name: '&fEnglish' # main language's display name, shown to players
country-codes: # read below
- AU
- NZ
- GB
- US
italian: # other language's ID
display-name: '&fitaliano'
country-codes:
- IT
# ...IP lookup's settings...
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Language detection
It is possible to detect a player's language the first time they join the server and ask them if they would like to set it as their language:
The plugin currently supports 2 methods specifiable at detector.method
:
CLIENT_LOCALE
: performs detection by checking the client's language settingsGEOLOCALIZATION
: performs detection by checking IP lookups' countries; requires IP lookup
When using the CLIENT_LOCALE
option, make sure to wait a delay-ms
of at least 4-5 seconds, otherwise the language may not be detected.
Custom commands
When a player's language is changed, the commands found at command.commands
are executed in order by the console. If you need the command to be executed by the player instead, just put a p:
ahead of it. Example: p: say Hello!
will make the player say "Hello!" when they change their language, if they have the permission to run the command.
This is useful if you have other plugins that support multiple languages but require a command to change them.
Placeholders
The following placeholders may be used at command.commands
:
{id}
: the new language's ID (ex. "english"){player}
: the player's name{uuid}
: the player's UUID
Adding languages
To add a new language, you just need to specify its ID and its display name. The ID has to respect the following pattern: ^[a-zA-Z0-9-_]{2,36}$
.
# ...languages' settings...
# ...default languages...
spanish: # ID - required
display-name: '&fespañol' # display name - required
country-codes: # country codes - optional
- ES # Spain
- MX # Mexico
- CO # Colombia
- AR # Argentina
- PE # Peru
- VE # Venezuela
- CL # Chile
- GT # Guatemala
- EC # Ecuador
- BO # Bolivia
- CU # Cuba
- DO # Dominican Republic
- HN # Honduras
- PY # Paraguay
- SV # El Salvador
- NI # Nicaragua
- CR # Costa Rica
- PA # Panama
- UY # Uruguay
- GQ # Equatorial Guinea
# ...IP lookup's settings...
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
At country-codes
you should specify the list of ISO 3166 country codes that represent countries where the language you are setting up is spoken.
Once done, follow these steps:
- open the
ChatPlugin/custom-messages
folder and create a new file calledmessages-spanish.yml
(use the actual ID) - copy and paste the content of the original
messages.yml
file into the file you have just created - translate every message in the new language
- open every file containing messages (see the list below) and add translations for the language
- save the modified files
- perform a
/chatplugin reload
and check if no errors are given in the console
Remember that if you are using a proxy you have to setup the language on every server under the network.
Files containing translations
The following files, sorted alphabetically, contain translations:
actionbars.yml
: different texts for every languageads.yml
: different ads for every languagebossbars.yml
: different titles for every languagechat.yml
: atchat.hover-info.player.hovers
andchat.hover-info.url.hovers
f3-server-names.yml
: different F3 server names for every languagejoin-quit-modules.yml
: different messages for every languagemotd.yml
: different MoTDs for every languageranks.yml
: different descriptions for every languagetablists.yml
: different headers and footers for every languageguis/*.yml
: different titles, open actions and icons for every languagescoreboards/*.yml
: different titles and lines for every language
/language
command
Depending on the version of ChatPlugin you are running, /language <language>
(free) or /language>
(premium) command is available.
Refer to the Getting started/Commands/User page for more info.
ChatPlugin - A complete yet lightweight plugin which handles just too many features!
This wiki is currently updated to version 1.9.10.
© 2024 Remigio07
Please report any mistakes and misspellings as described at Home/Reporting issues.