4 Language support
Thijs Wiefferink edited this page 2016-07-25 15:31:07 +02:00

AreaShop has full language support, after starting the plugin you will find a lang folder inside the plugin folder, which contains all the language files supplied by default (currently supported languages). These files will be overwritten each reload/restart of the server to keep them up-to-date.

If you need a language that is not yet available by default then you have 2 options:

  1. Translate AreaShop to your language of choice on Transifex (translation platform).
  • Will be included in AreaShop with the next update when it is translated for more as 70%.
  • You can easily collaborate with others to get it done easier.
  • The translations need to be neutral, in the style of the original messages.
  1. Create your own language file locally.
  • The translations is not available for others (you can however still send me the translated file).
  • You can style (wording and visually) the messages however you want.

Translating on Transifex

For translating AreaShop to a new language you can use the Transifex platform, first got to the Transifex project page for AreaShop. At this site you need to create an account, and after that you can request to be translator of one of the existing languages or request a language to be added. After you have done this I have to approve you as a translator, when that is done you can start. I prefer requests for the general language, and not the language with the additional suffix for a certain country. This is because I don't think it is necessary to have two almost identical translations if a language is used in more as one country.

Translating

The default project page lists the available languages and how far those are done. If you click the name of a translation it will take you to a page listing all files that need translation (currently only EN.yml and that will probably stay like that). If you click this file it will open a popup where you can see how many strings/words/remaining strings there are. In this popup you can click the "Translate now" button to start translating. That will take you to the editor for translations. There you can see the original text and current translation at the left side. If you click one of them you can start adding a translation in the box on the right.

In the bar on top you can select the Untranslated tab to only see the strings that still need a translation. The site also features a review system that is normally used if more then one user is translating, you currently don't have to do anything with that. If you have translated something you can also leave notes about it if you for example are not sure about the translation.

Note: If you request a new language, please request the general version of the language instead of the country specific version, for example for Spanish you should request the es version but not the es_MX version (which is Mexico specific). Translating is already a lot of work, so lets not make specific versions for countries (if you have a good reason for it because there are major differences please contact me).

Keeping track of common words

There is also a feature called Glossary, this is sort of a dictionary for this plugin. You can add common words like region into this to get a consistent translation throughout the plugin (basically just to remember what kind of word you used for certain things).

Details

Please leave the color and formatting codes the same as the original and try to keep all replacement tags like %0% in the strings. Otherwise translations would be inconsistent or missing information. Before releasing a version I will download the translations, add a header to them with some information (including a mention of the translators) and then I add them to the plugin.

Translating locally

Copy the source file of your choice (you probably want to start with English), preferably change the name of the file to <servername>.yml. If you change it to a language code of a language that is currently not in AreaShop it could become overwritten when that specific language is added to a new version of AreaShop later.

The %0% things are placeholders for values that are added when sending the string to the player. You can rearrange them but it is not recommended to delete them because then players will miss certain parts of information. If you have created your own language file then change the config to use your file, you need to change the language setting in config.yml for this. Use the part of the filename before .yml in this setting. The plugin will try to use the string from your specified language file first, but will fall back to the default English string if it can't find it (so you can also just create a language file with just the strings you want to change).

Message format specifications

AreaShop 2.3.0 and higher use a message format that supports tooltips and executing commands when the player clicks the message. Examples and details about this format can be found below, the AreaShop language file can be found here, which contains the default messages.

Colors & Formatting:

  • Colors and formatting normally go on until changed/removed, but they reset on new lines
  • Color tags:
    • [white], [black], [yellow], [gold], [aqua], [dark_aqua], [blue], [dark_blue], [light_purple], [dark_purple], [red], [dark_red], [green], [dark_green], [gray], [dark_gray]
    • When you use a color it will override the last one
  • Formatting tags:
    • [bold], [italic], [underlined], [strikethrough], [obfuscated]
    • When you use a formatting tag it will enable this formatting
    • When you use a close tag of a format it will disable that formatting
  • The color and formatting inside a hover is seperate (start with nothing, resets each line)
  • Tags are not case sensitive
  • The following tags are equivalents:
    • [strikethrough] = [s]
    • [bold] = [b]
    • [italic] = [i]
    • [underline] = [u]

Breaks (newlines):

  • The break symbol is: [break]
  • Using it will cause the text to wrap to the next line in chat, so if [break][break] is used it will leave an empty line
  • The end of a list element (string) does NOT automatically result in a break in the chat
  • After using [break] there may not be more text in this line, from there only more [break] tags are allowed (more text can go in a new list entry)

Special effect tags:

  • Tags are for adding special effects to a part of the text, used as the following: " link: http://google.com"
  • Supported tags:
    • Link: If clicked it will cause a “Do you want to visit this website?” popup
    • Hover: If hovered over with the mouse it will give information in a little box
      • You can use multiple lines with this tag to get multi-line hover popups
    • Suggest: If clicked it will put a string into the chat box
    • Command: If clicked it will execute a command as the player
  • The hover tag supports all colors and formatting like with normal text
  • Tags do not need to be indented, but normally are for readability
  • Tags are not case sensitive

Escaping:

  • [esc] can be used to escape 1 character, so if you want to have "link: example.com" as text you need a [esc] in front of this. Then the first character will be escaped and since "ink: " is not a valid tag anymore it will be shown as text instead of being used as link on the previous text part.
  • Placing "[esc][esc]" in the text will result in the text "[esc]" being printed, the first escape will be handled as such, this will escape [ and therefore the text behind this will be "esc]" and this is just text
  • Also works for variables

Guidelines

  • Use lowercase characters for tags
  • When using a special effect tag indent the line by 4 spaces (up for debate)

Message format examples

The below examples assume writing the format in YAML format.

Simple messages

A simple message without any formatting.

message: "You do not have permission to use that command!"

A message that is bold and red to make it look more serious.

message: "[red][bold]You really do not have permission!"

A message with more color and format changes.

message: "[red][bold]You[/bold] really do not have [green][underline]permission[reset]!"

A multi-line message.

message:
  - "First line"
  - "[red], still on the first line[break]"
  - "Second line because of the break above"
  - ", but no color."

Using hover/click parts

A message with some hover tooltips, each hover will start on a new line.

message:
  - "Hello there!"
  - "    hover: Have a good day!"
  - "    hover: Second tooltip line :)"

A message with a tooltip and command.

message:
  - "Hello there!"
  - "    hover: Click me to use /help!"
  - "    command: /help"