Messages and language
Editing what players see, the three shipped languages, and adding your own.
Every string a player or your console can see lives in a language file. Nothing is written into the plugin itself, so anything you want reworded, you can reword.
The files
plugins/NationCrest/lang/
Pick one with language in config.yml, without the .yml:
language: fr_FRThen /flag reload.
What is in a file
The tag put in front of most messages. {prefix} in any other message is replaced with it, so you set it once.
Permission denials, unknown player, unknown country code, player only, and command usage lines.
The list /flag prints. A list of lines, so add or remove lines freely.
The four replies to /flag toggle, /flag show and /flag hide.
What /flag info prints, for yourself and for somebody else, plus the two notes about a hidden flag and a manual override.
Replies to /flag set, /flag reset and /flag reload.
The block /flag debug prints. A list of lines, so you can trim it down if you find it noisy.
The words filled into the debug block, such as not loaded, ready and on cooldown for {seconds}s, so the whole of /flag debug reads in your language.
The two words %nationcrest_toggled% returns, Shown and Hidden by default.
Warnings that go to your server log rather than to a player: the proxy IP forwarding warning, the conflicting plugin warning and the country database status lines. These are here so they can be translated too.
Placeholders inside messages
Messages use curly brackets:
info:
other: '{prefix}&f{player} &7is showing as &f{country} &7({code}) {display}'| In a message | Filled with |
|---|---|
{prefix} | The prefix key |
{player} | A player name |
{country} | The full country name |
{code} | The two letter code |
{display} | The formatted flag |
Which of these are available depends on the message. The shipped file shows what each one gets.
Do not switch these to angle brackets. Angle brackets are used by Prism's own colour tags and the two would be read as each other. Angle brackets are only used in command usage text, for example /flag set <player> <code>.
Colour
Same syntax as everywhere else in this plugin. See Display modes.
Adding your own language
The plugin does not need an update for this.
Copy a shipped file
Copy en_US.yml to whatever you want to call it, for example de_DE.yml. Java locale style names are the convention, but any name works.
Translate it
Leave the keys alone, change the values. Keep lang-version where it is.
Your own file is never rewritten by an update. Any message added in a later version that your file does not have yet shows in English until you add it.
Point the config at it
language: de_DEReload
/flag reload.
If you name a language that has no file, the plugin logs a warning and falls back to English rather than breaking.
A language file you wrote yourself is loaded exactly as it stands. The three shipped files are version managed and gain new keys automatically when the plugin updates, yours will not. If a plugin update adds a message, compare your file against en_US.yml and copy the new key across.