main/Translations

How To: Translations

Quote from WIP:

This page is a work in progress.

This page will help users to translate the plugin into their language and submit them for inclusion. Users that wish to translate the strings into their language should have a firm grasp of both English and the language they are translating into.

Aquire Translations File

Before we can do anything, we need a copy of the default translations file. You can get the translation file from the latest source zip from the files page, or from the SVN repository.

svn://svn.bukkit.org/minecraft/dispnamechanger/mainline/trunk/translations/

Reading Translations

The first step to translating anything into another language is to understand how the translation files work. DispNameChanger (DNC) uses the Java Localization tools for it's translations. This means that all the strings that are relevant reside inside of a java properties file.

Java properties files are in key/values format.

key=value

The argument to the left of the equal sign ( = ) is the key. The argument to the right of the equal sign is the value. So for translations, the string that is being replaced is to the left, and the string that should be used for translation is to the right. An example of this would be

permission_check = You don't have permission to check names!

permission_check is the string that is looked for in the properties file for when a user doesn't have permission to check names. To the right is the actual string that is used. So when you go to translate "You don't have permission to check names!" to German "Sie haben keine Berechtigung, auf Namen überprüfen!"* you would replace the string on the right of the equal sign.

permission_check = Sie haben keine Berechtigung, auf Namen überprüfen!

Translating Arguments

If you have already perused the Translations file, you will have encountered strings with numbers enclosed in brackets {0}. This is because the string has arguments placed into it at runtime. An example of this is:

info_spout = Spout detected! Using version {0}.

The version number for Spout can change, depending on what version of Spout you are using. Therefore the easiest way to change the string without having to change our strings for each update of Spout is to add a variable to the string, and replace the variable at runtime. So an example of what the string would look like after the argument is placed in it:

Spout Detected! Using version 644.

When translating this string, the german version might look like:

info_spout = Spout erkannt! Mit Version {0}.

When translating, always carry the argument numbers over, otherwise the translation won't work when used. The German* version of this translation would probably look like the following in console:

Spout erkannt! Mit Version 644.

Multiple Arguments and Single Quotes

Sometimes there are multiple arguments to a translation. The order of the arguments will change depending on the language. Take the following string for the check command:

info_check_single = {0} is really {1}.

Here we are telling the user that someone is really someone else. I.e.

SuperBob is really userbob225.

Here, {0} represents who the user was checking for, and {1} is who the user was found to be. In a language like Spanish, userbob225 might come before Superbob, so you would put {1} before {0} in the translation.

An interesting facet of using the Java Localization api is that single quotes ( ' ) signify the start of a string, and anything after words should be ignored by the Formatter when used. Take the following string for example:

userbob225's name is now SuperBob.

In the translation file, we might try to use the following:

info_nick_caller = {0}'s name is now {1}.

However, it would turn out like this in usage:

userbob225's name is now {1}.

This is because ' signified the start of a string. To ensure that the {1} argument gets replaced, we need to escape the singlequote with another singlequote.

info_nick_caller = {0}''s name is now {1}.

which will now print as:

userbob225's name is now SuperBob.

File Submission

Once you have completed a translation, please send me a PM with a link to the .properties file as well as the name of the language that you have translated it into. Also please try to ensure that your file uses UTF8 when translating or else it might not come out correctly when used in the server. Once I receive a full translated file I will add it to the translations. If you would like to submit edits to a translation file, please send me the updated .properties file.

<sub>*A Google translate version of the English string in German. Can not guarantee correctness.</sub>


Comments

Posts Quoted:
Reply
Clear All Quotes