-
Notifications
You must be signed in to change notification settings - Fork 40
Localization Development Guidelines
The user has only a serverLanguage option in simpleserver.properties. There are no files and everything is hidden in the packaged jar itself.
This approach obviously leads to minimal distractions and problems for users.
Translators download a pre-made template.json localization file. The file can be put into a folder called translations (which doesn't exist yet) and name it en.json (where "en" obviously is the respective language code). The file is in JSON format with a single dictionary with all the translation pairs inside. If a localization is complete the translator can just leave it in the folder or choose to get in touch with us. In latter case we add him to the localization repository where he can release his translation.
After the codebase gets updated there might be missing translations. The translators simply pull the changes from the Localization repository and translate the new lines which are always at the end of the file. When they're done they push their changes. We'll include the translations in the packaged release - later on, when we have many people working on the translations, they will be released as a second release which would be released shortly after the original release.
Developing isn't slowed down by localization at any time and there are easy methods for getting translations which should be used for all messages/notifications the player receives. Those methods are:
- A
Translations.t(String key)method for loading the translation directly (should be used with a static import) - A
Translations.t(String key, Object... args)method for loading translated & formatted messages (should be used with a static import) - Methods used very often for output for players have a Localized version (e.g.
Player.addTMessage(String msg))
The class Translations is a singleton and has no language defined. It contains the t method which at the beginning just returns the key passed to it. When the Server class successfully loads the server properties it sets the language for the translations. It then looks for the file .lang in the external and internal localization folders and loads its contents.
Each time there someone makes changes in the code regarding the translations, the template.json file will be updated by us. Later on (when we will have finished some needed code parts) our IRC bot Herobrine will update the template.json file from the source code automatically. He will also handle the including of the Localization repository in the release build so that everyone can use the latest translations. This way there aren't any localization files in the main repository.