This document describes the process of localizing NetLogo. Localization is the process of translating strings in NetLogo to another language. This document assumes that you are using NetLogo 5.0.
Grab GUI_Strings_en.txt and Errors_en.txt from https://github.com/NetLogo/NetLogo/tree/5.x/dist/i18n, or from your clone of the NetLogo git repo, and copy them to Copy GUI_Strings_ja.txt and Errors_ja.txt
Notice that en is renamed to ja. ja is the language code for Japanese. Localizers will (instead of using ja) have to use the language code for their target language, obviously. Language codes can be found here: http://www.loc.gov/standards/iso639-2/php/code_list.php
(We also support adding a country code, for example: GUI_Strings_ja_JP.txt. However, the reasons for doing that are more complicated and I'm not ready to explain them just yet.)
You must open the file in UTF-8, and save the file in UTF-8. Most text editors have support for this. Here are the instructions on how to do so in TextEdit (on Mac):
"To choose a different text encoding:
In TextEdit, choose File > Open. Choose an encoding type from the Plain Text Encoding pop-up menu. If you don’t see the encoding you want to use, choose Customize Encodings List and then select the encodings you want to include. Select the file and then click Open."
Each of the files is a series of key value pairs, separated by an equals sign like so: key = value. The content on the right hand side of the equals sign (the value) is what needs to be translated to the target language. The key must be left exactly the same. For example:
In GUI_Strings_en.txt we have: common.observer = observer
and in GUI_Strings_ja.txt we have: common.observer =オブザーバ
You should translate all of the file. However, this isn't 100% required, you can translate just some of the values, leaving the English in place for the others. Doing this will cause the application to display some strings in the target language, and some in English. This is reasonable during testing.
Once you're done translating, save the file in UTF-8. If you opened it in your text editor in UTF-8, then it will probably save in UTF-8 as well.
Java's built in internationalization library won't read the files in UTF-8. First, they must be converted to ascii. To do this, use Java's native2ascii tool at the command line, like so:
native2ascii -encoding UTF-8 GUI_Strings_ja.txt > GUI_Strings_ja.properties
This creates an ascii file called GUI_Strings_ja.properties that contains the same contents of the original file, except in an encoding that Java can read it in.
Do the same thing for the Errors_ja.txt
Currently, to test the localization, you must:
See the attached script for the commands needed to do steps 1-3.
If everything went well so far, you should be able to restart NetLogo as normal. Once it is restarted, type
__change-language into the command center. A dialog will open showing a list of the available languages. Your new language should appear in the list. Select it, and restart NetLogo again. NetLogo should open in your new language.
(Normally NetLogo would default to opening in whatever language your OS is set to. There is a bug in NetLogo 5.0RC3 preventing this from happening, forcing you to use
__change-language instead. We will fix this bug in the next build.)
There is a script https://github.com/NetLogo/NetLogo/blob/5.x/bin/localize.sh to handle step 4 and and the first parts of step 5 (recreating the jar file) automatically. The script works on Mac OS X or Linux. (It might work on Windows if you run it under Cygwin.) Before running this script, you'll want to back up your NetLogo.jar file first.
To run the script execute this command:
substituting the appropriate language code for