Difference between revisions of "How to translate OpenJUMP into another language"

From OpenJUMP Wiki
Jump to navigation Jump to search
 
(32 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== A - The steps on how to translate OpenJUMP ==
+
'''back to''' [[Index]] page
 +
== '''The steps on how to translate OpenJUMP''' ==
  
This in an ''example for'' translation into ''Brazilian Portugese''.
+
This in an ''example for'' translation into ''Brazilian Portuguese''.
People interests in creating a new language file my read part B (below) as well
 
  
* 1) download the last nightly built from http://jump-pilot.sourceforge.net/download/nightlybuild/
+
;NOTE
* 2) unpack it
+
:The steps below show the translation on the operating system windows. The steps however are pretty much generally the same for every operating system.
* 3) if you work on Windows:
 
** set in the file YOUR_openjump_folder\bin\openjump.bat the i18n option to portugese language in the "start javaw" line:
 
** eg. start javaw -Dlog4j.configuration=file:./log4j.xml -Xms256M -Xmx256M -cp %CLASSPATH% com.vividsolutions.jump.workbench.JUMPWorkbench -properties workbench-properties.xml -i18n pt_BR -plug-in-directory %LIB%/ext
 
** otherwise modify the appropriate .sh file
 
* 4) go to the file: YOUR_openjump_folder\lib\jump-workbench-2007XXXX-XXXX.jar (where xxx are nightly built specific number)
 
* 5) for safety reasons make a copy of the file to some other place
 
* 6) rename the .jar file to .zip
 
* 7) unpack it somewhere
 
* 8) look in the unpacked files for folder called "language" and a file called "jump_pt_BR.properties"
 
* 9) open the file with your favorite editor and translate the strings:
 
** you will see that on left side is an identifier string while on the side of the "=" equal sign is the translated text
 
** a hint: new strings have a date line just before like [sstein 7 march 2007]
 
* 10) after you have translated, safe the jump_pt_BR.properties file
 
  
note: the following steps are useful if you want to check your
+
;<span style="color:#FF0000">ATTENTION
translation in OpenJUMP;
+
:<span style="color:#FF0000">It's crucial that you use the latest snapshot. '''Only snapshots''' are packaged with the language files exposed in the ''/language'' folder.</span>
  
* 11) pack all the stuff of the previously extracted zip file to a new .zip which has the same name as the old
+
=== '''Translation process''' ===
* 12) rename the just packed file .zip to .jar
+
# download
* 13) copy it in the same location as the old .jar (means the \lib\ folder)
+
#* the most recent development snapshot from the [[Downloading OpenJUMP#Snapshots|snapshot repository]]
* 14) start openjump with the openjump.bat file and check your translation
+
# extract
 +
#* it contains a folder named like 'OpenJUMP-DATE-rREV-CORE' (called '''OJfolder''' in the further steps)
 +
#* unpack it to a path of your choice, e.g. to '<tt>C:\</tt>' should result in a folder structure like
 +
#: <tt>C:\OJfolder\bin\
 +
#: C:\OJfolder\lib\
 +
#: C:\OJfolder\licenses\
 +
#: C:\OJfolder\readme.txt</tt>
 +
# set the language
 +
#;<span style="color:#FF0000"> SKIP
 +
#:<span style="color:#FF0000"> if your operating system is configured to use the language you want to translate OJ to you can skip this step (e.g. your Windows is portuguese and you want to edit OJ's portuguese translation)
 +
#* edit the start script for your platform
 +
#* locate the following lines in the file '''OJfolder\bin\oj_windows.bat''', a similar line exists in '''oj_linux.sh''' for MacOS and Unix os's
 +
#: <pre> rem --- uncomment and change your language/country here to overwrite OS locale setting ---</pre>
 +
#: <pre> rem set JAVA_OPTS=%JAVA_OPTS% -Duser.language=de -Duser.country=DE</pre>
 +
#* uncomment the line
 +
#* add your language and optionally country code
 +
#: <pre> set JAVA_OPTS=%JAVA_OPTS% -Duser.language=pt -Duser.country=BR </pre>
 +
# extract the language files
 +
#;<span style="color:#FF0000"> SKIP
 +
#:<span style="color:#FF0000"> if using a current snapshots as they distribute the ''language/'' folder already as described below. Be aware that this is not the case for stable releases, but they are not suggested for translation work anyway because they are probably missing changes of the development tree.
 +
#* extract from 'OJfolder\lib\openjump-core-*.jar' (where * are nightly built specific name) only the folder '''language''' into 'OJfolder' resulting in a folder structure like
 +
#: <tt>C:\OJfolder\bin\
 +
#: C:\OJfolder\'''language'''\
 +
#: C:\OJfolder\lib\
 +
#: C:\OJfolder\licenses\
 +
#: C:\OJfolder\readme.txt</tt>
 +
#:'''NOTE''' that OJfolder/'''language'''/ contains lots of ''jump_<languagecode>_<countrycode>.properties'' files
 +
# look in '''language''' folder for a file called "jump_pt_BR.properties" (or the language you want to add/edit). If it does not exist see [[#On new translations]] and come back here thereafter.
 +
# open the file with your favorite editor and translate the strings
 +
#: '''HINT''' if it appears like one line of text try an editor that supports unix line breaks e.g. wordpad
 +
# you will see that on left side is an identifier string while on the right side of the "=" (equal sign) is the translated text
 +
#: '''HINT''' new strings have a date line just before like [sstein 7 march 2007]
 +
# when you are finished editing, save the file
 +
#; NOTE
 +
#: You should verify your changes by running OpenJUMP now as described in the next step.
  
if you dont want to test:
+
=== '''Formatting message''' ===
* 15) if you finished your translation send me the jump_pt_BR.properties file (sstein@geo....) and i will add it to our sourcecode repository.
+
Messages can use variables. For example :
 +
#: <pre>openjump.error = The layer {0} contains invalid features.</pre>
 +
Note that in case a message contains variables (and only in this case), apostrophes must be doubled :
 +
#: <pre>openjump.error = L''attribut {0} existe déjà!</pre>
  
After adding it, the nightly built of the next day should include your Portugese translation. I hope that is detailed enough :o) If questions appear please don't hesitate to contact me (Stefan/sstein)
+
=== '''Verification''' ===
 +
# start openjump with the start script for your platform
 +
# check the translated strings
  
== B - On new translations ==
+
=== '''Release''' ===
 +
# send me the modified properties file to sstein@geo(....) or
 +
# to the development mailing list http://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
  
* please simply make a copy of the file jump_en.properties file and rename the copy to your language abbreviation (e.g. the swedish one should be like: jump_se.properties)
+
After adding it, the nightly built of the next day should include your translation. I hope that is detailed enough :o) If questions appear please don't hesitate to contact me (Stefan/sstein) or the mailing list.
 +
 
 +
== '''On new translations''' ==
 +
 
 +
* please simply make a copy of the file jump.properties file and rename the copy to your language abbreviation (e.g. the swedish one should be like: jump_se.properties)
 
* translate everything
 
* translate everything
* put it as additional file in the zip as describe above
+
* put the properties file into '''language''' folder
 +
 
 +
== '''Problems with "special" characters''' (e.g. translation of asian languages or european accented characters)==
 +
 
 +
Use an '''UTF-8''' capable editor (notepad, notepad++, jEdit ...) to do the translation and save a '''UTF-8''' text file eg. as '''jump_zh_HK-utf8.properties'''.
 +
 
 +
In a second step convert the whole file
 +
: Convert the utf-8 to unicode literals using native2ascii.exe (part of the java development kit, e.g. C:\Program Files\Java\jdk<version>\bin\native2ascii.exe
 +
:<pre>native2ascii.exe -encoding utf8 jump_zh_HK-utf8.properties jump_zh_HK.properties </pre>
 +
 
 +
or
 +
 
 +
:Convert via web service copy & paste from/to the text editor and save with encoding ISO-8859-1 (latin-1). To find online services use your favorite search engine with keywords like "online converter unicode literal" or "online escape unicode". Two examples at the time of writing [Apr.2012] include
 +
: http://www.htmlescape.net/javaescape_tool.html
 +
: http://www.snible.org/java2/uni2java.html
 +
 
 +
== '''Useful tools''' ==
 +
 
 +
=== Attesoro ===
 +
 
 +
* intuitive to use properties file editor with '''automatic''' utf-8 escape char support
 +
* get it at
 +
** http://attesoro.org/translate.html
 +
** mirror of the version at the time of writing (http://sourceforge.net/projects/jump-pilot/files/tools/attesoro_1_8.jar)
 +
 
 +
=== 7zip ===
 +
 
 +
* can be used to unpack jar files (which use the zip compression)
 +
* a graphical (un)packer utility
 +
* available for windows or unofficially for several other operating systems (see downloads page) at
 +
** http://www.7-zip.org/
  
== C - Useful tools ==
+
=== jEdit ===
  
* some of the developers use the prb-editor for translatiion http://prbeditor.dev.java.net/
+
* a java based text editor
 +
* support all major text encodings
 +
* mighty search and replace engine
 +
* get it at
 +
** http://www.jedit.org/
 +
* If you use jEdit, you might want to download the macro called "Escape properties" on jEdit site.

Latest revision as of 09:29, 20 November 2019

back to Index page

The steps on how to translate OpenJUMP

This in an example for translation into Brazilian Portuguese.

NOTE
The steps below show the translation on the operating system windows. The steps however are pretty much generally the same for every operating system.
ATTENTION
It's crucial that you use the latest snapshot. Only snapshots are packaged with the language files exposed in the /language folder.

Translation process

  1. download
  2. extract
    • it contains a folder named like 'OpenJUMP-DATE-rREV-CORE' (called OJfolder in the further steps)
    • unpack it to a path of your choice, e.g. to 'C:\' should result in a folder structure like
    C:\OJfolder\bin\
    C:\OJfolder\lib\
    C:\OJfolder\licenses\
    C:\OJfolder\readme.txt
  3. set the language
    SKIP
    if your operating system is configured to use the language you want to translate OJ to you can skip this step (e.g. your Windows is portuguese and you want to edit OJ's portuguese translation)
    • edit the start script for your platform
    • locate the following lines in the file OJfolder\bin\oj_windows.bat, a similar line exists in oj_linux.sh for MacOS and Unix os's
     rem --- uncomment and change your language/country here to overwrite OS locale setting ---
     rem set JAVA_OPTS=%JAVA_OPTS% -Duser.language=de -Duser.country=DE
    • uncomment the line
    • add your language and optionally country code
     set JAVA_OPTS=%JAVA_OPTS% -Duser.language=pt -Duser.country=BR 
  4. extract the language files
    SKIP
    if using a current snapshots as they distribute the language/ folder already as described below. Be aware that this is not the case for stable releases, but they are not suggested for translation work anyway because they are probably missing changes of the development tree.
    • extract from 'OJfolder\lib\openjump-core-*.jar' (where * are nightly built specific name) only the folder language into 'OJfolder' resulting in a folder structure like
    C:\OJfolder\bin\
    C:\OJfolder\language\
    C:\OJfolder\lib\
    C:\OJfolder\licenses\
    C:\OJfolder\readme.txt
    NOTE that OJfolder/language/ contains lots of jump_<languagecode>_<countrycode>.properties files
  5. look in language folder for a file called "jump_pt_BR.properties" (or the language you want to add/edit). If it does not exist see #On new translations and come back here thereafter.
  6. open the file with your favorite editor and translate the strings
    HINT if it appears like one line of text try an editor that supports unix line breaks e.g. wordpad
  7. you will see that on left side is an identifier string while on the right side of the "=" (equal sign) is the translated text
    HINT new strings have a date line just before like [sstein 7 march 2007]
  8. when you are finished editing, save the file
    NOTE
    You should verify your changes by running OpenJUMP now as described in the next step.

Formatting message

Messages can use variables. For example :

  1. openjump.error = The layer {0} contains invalid features.

Note that in case a message contains variables (and only in this case), apostrophes must be doubled :

  1. openjump.error = L''attribut {0} existe déjà!

Verification

  1. start openjump with the start script for your platform
  2. check the translated strings

Release

  1. send me the modified properties file to sstein@geo(....) or
  2. to the development mailing list http://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

After adding it, the nightly built of the next day should include your translation. I hope that is detailed enough :o) If questions appear please don't hesitate to contact me (Stefan/sstein) or the mailing list.

On new translations

  • please simply make a copy of the file jump.properties file and rename the copy to your language abbreviation (e.g. the swedish one should be like: jump_se.properties)
  • translate everything
  • put the properties file into language folder

Problems with "special" characters (e.g. translation of asian languages or european accented characters)

Use an UTF-8 capable editor (notepad, notepad++, jEdit ...) to do the translation and save a UTF-8 text file eg. as jump_zh_HK-utf8.properties.

In a second step convert the whole file

Convert the utf-8 to unicode literals using native2ascii.exe (part of the java development kit, e.g. C:\Program Files\Java\jdk<version>\bin\native2ascii.exe
native2ascii.exe -encoding utf8 jump_zh_HK-utf8.properties jump_zh_HK.properties 

or

Convert via web service copy & paste from/to the text editor and save with encoding ISO-8859-1 (latin-1). To find online services use your favorite search engine with keywords like "online converter unicode literal" or "online escape unicode". Two examples at the time of writing [Apr.2012] include
http://www.htmlescape.net/javaescape_tool.html
http://www.snible.org/java2/uni2java.html

Useful tools

Attesoro

7zip

  • can be used to unpack jar files (which use the zip compression)
  • a graphical (un)packer utility
  • available for windows or unofficially for several other operating systems (see downloads page) at

jEdit

  • a java based text editor
  • support all major text encodings
  • mighty search and replace engine
  • get it at
  • If you use jEdit, you might want to download the macro called "Escape properties" on jEdit site.