Skip to content

Translations

LoJoSho edited this page Nov 10, 2020 · 4 revisions

Translations allow Civs to provide messages in different languages as well as the ability for admins to customize them for each individual server. Currently, the plugin ships with translation files for English, Portuguese, German, Hungarian, Chinese, Spanish, Russian, French, Czech and Vietnamese.

Changing the default language

Set the default-language field in the plugin's config to the desired language. Individual players can override this setting for themselves using the in-game menu.

# Config.yml
default-language: en # en, pt-br, de, hu, zh, zh-tw, es, ru, fr, cs or vi.

Modifying the default translations

To modify the messages in a specific language, open the appropriate file in the plugins/Civs/translations folder and edit the line correspondent to that message. Remember to uncomment the line by removing the leading # or the change won't be read by Civs.

Example

To modify the name of the 'Catapult' to 'Trebuchet' in the english translation, open the en.yml file and change

catapult-name: "Catapult"

to

catapult-name: "Trebuchet"

Placeholders

Some messages have placeholders in them, which are replaced by Civs with different values, depending on the message. They are identified by a dollar sign $ followed by a number, for example $1. When translating a message, you should reposition the placeholder so that the value gets placed in the correct position for that language.

One example of such messages is the pop-desc string:

pop-desc: "$1 Population / $2 Housing / $3 Villagers"

In this instace, $1 is replaced by the population of the town the player is browsing. Similarly, $2and $3 are replaced by the amount of housing and villagers that town currently has.

Colors

Default Colors

Translation messages can contain color codes by using a special syntax. This would make the 'Destroy' text appear red in-game. Colors currently do not go over lines.

destroy: "@{RED}Destroy"

Hex Colors

Translation messages also support hex colors, allowing you to choose exactly what colors you want each translation to have. You can find a Hex color picker here.

destroy: "@{#FF0000}Destroy"

Line Breaks

To insert a line break, simply type \n in the yml and it will create a new line.

destroy: "@{RED}Destroy\n@{WHITE}Them!"

A good example of what you can do with line breaks & colors would be this:

andesitemine-name: "@{#FF0000}Andesite Mine"
andesitemine-desc: "@{WHITE}Used dig andesite out of the ground\n@{GREEN}Size: 9x9x9\n@{WHITE}Production:\n @{WHITE}1 Stone Shovel -> 8 Andesite\n@{GREEN}Cooldown: 5 Minutes"