Translating JAMS

From ILMS-Wiki
(Difference between revisions)
Jump to: navigation, search
(Uploading language files to the JAMS SVN repository)
 
(43 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
== JAVA localization basics ==
 
You can translate the JAMS graphical user interfaces by editing JAMS language files. Those files contain lines of the format  
 
You can translate the JAMS graphical user interfaces by editing JAMS language files. Those files contain lines of the format  
 
  <key>=<value>
 
  <key>=<value>
 
where key is some string identifier and value a term in a certain language. An example would be:
 
where key is some string identifier and value a term in a certain language. An example would be:
  ExplorerDisabled=JAMS Explorer is diabled in this version!  
+
  ExplorerDisabled=JAMS Explorer is disabled in this version!  
 
The interfaces are translated by replacing the right part with the translated terms. In order to preserve a proper generation of combined terms, leading and trailing whitespace characters must be kept. The results must be stored in a file following the naming convention  
 
The interfaces are translated by replacing the right part with the translated terms. In order to preserve a proper generation of combined terms, leading and trailing whitespace characters must be kept. The results must be stored in a file following the naming convention  
 
  <code><name>_<lcode>_<ccode>.properties</code>
 
  <code><name>_<lcode>_<ccode>.properties</code>
 
with the following meaning:
 
with the following meaning:
* <code><name></code> can be any string describing the files content
+
* <code><name></code> is a string describing the files content, i.e. "JAMSBundle"
 
* <code><lcode></code> is a 2-character abbreviation for the language name according to ISO 639-1, see http://www.loc.gov/standards/iso639-2/php/code_list.php for a complete list.
 
* <code><lcode></code> is a 2-character abbreviation for the language name according to ISO 639-1, see http://www.loc.gov/standards/iso639-2/php/code_list.php for a complete list.
 
* <code><ccode></code> is a 2-character abbreviation for the country name according to ISO 3166-1, see http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm for a complete list.
 
* <code><ccode></code> is a 2-character abbreviation for the country name according to ISO 3166-1, see http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm for a complete list.
 
As an example, the proper name for a file containing brazilian portuguese language strings for JAMS would be <code>JAMSBundle_pt_BR.properties</code>. In general, the country code can be omitted, e.g. <code>JAMSBundle_pt.properties</code> is a proper file name for portuguese translations in general.
 
As an example, the proper name for a file containing brazilian portuguese language strings for JAMS would be <code>JAMSBundle_pt_BR.properties</code>. In general, the country code can be omitted, e.g. <code>JAMSBundle_pt.properties</code> is a proper file name for portuguese translations in general.
  
In order to patch the language files of already existing JAMS libraries, proceed as follows.
+
== Patching existing JAMS libraries ==
First of all, make sure you have the JDK java development package installed. The files that I am referring to are part of the new JAMS version which has a new package structure. Please install the current version of JAMS that is available at http://jams.uni-jena.de. Afterwards, you can edit the language files by following the these steps:
+
The following instructions assume a Windows system. They look similar for other systems.
 
+
In order to patch the language files of already existing JAMS libraries, proceed as follows:
 +
* make sure you have the JDK java development package installed
 
* open a DOS command prompt
 
* open a DOS command prompt
 
* change into the directory containing the JAMS *.jar files (<code>cd c:\program files\jams\lib</code>)
 
* change into the directory containing the JAMS *.jar files (<code>cd c:\program files\jams\lib</code>)
 
* extract the JAMS language file by running  
 
* extract the JAMS language file by running  
 
   <code>jar -xf jams-main.jar resources/JAMSBundle.properties</code>
 
   <code>jar -xf jams-main.jar resources/JAMSBundle.properties</code>
* edit the file resources\JAMSBundle.properties as you like, save it and rename it to resources\JAMSBundle_??.properties, where ?? stands for
+
* translate the file resources\JAMSBundle.properties, save it and rename it to resources\JAMSBundle_<lcode>_<ccode>.properties according to the conventions described above
 
* write the modified file back to the archive by running
 
* write the modified file back to the archive by running
   <code>jar -uf jams-main.jar resources/JAMSBundle_pt.properties</code>
+
   <code>jar -uf jams-main.jar resources/JAMSBundle_<lcode>_<ccode>.properties</code>
* delete the extracted files by running
+
  <code>rmdir /s/q resources</code>
+
* extract the JUICE language file by running the command
+
  <code>jar -xf jams-ui.jar resources/JUICEBundle_pt.properties</code>
+
* edit the file resources\JUICEBundle_pt.properties as you like
+
* write the modified file back to the archive by running
+
  <code>jar -uf jams-ui.jar resources/JUICEBundle_pt.properties</code>
+
 
* delete the extracted files by running
 
* delete the extracted files by running
 
   <code>rmdir /s/q resources</code>
 
   <code>rmdir /s/q resources</code>
 +
 +
On the next start of JAMS, the interface should show up with the translated terms. If not, make sure that the "Force language" entry in the JAMS properties dialog is empty. If the interface still comes up with the default localization (english), you can also force JAMS to use a localization by entering its language code in the "Force language" entry of the JAMS properties dialog. JAMS must be restarted after changing the "Force language" entry in order to correctly apply the new localization.
 +
 +
== Uploading language files to the JAMS SVN repository ==
 +
 +
In order to make changes to JAMS language files permanent, these need to be stored in the JAMS Subversion repository. For further information about the Subversion (SVN) version control system, please have a look at these sites:
 +
* http://subversion.tigris.org
 +
* http://en.wikipedia.org/wiki/Subversion_(software)
 +
There is a huge number of different SVN clients available, have a look at http://en.wikipedia.org/wiki/Comparison_of_Subversion_clients for a probably incomplete list of them.
 +
The following steps assume that you are using the SVN command line client that comes with the SVN installation package (binary packages available here: http://subversion.tigris.org/getting.html):
 +
* open a DOS command prompt
 +
* create/change into the directory where you want to download the language files to (e.g. cd c:\temp\JAMSi18n)
 +
* issue the following command:
 +
<code>svn co --username jamsi18n --password jamsi18n http://svn.geogr.uni-jena.de/svn/jams/trunk/JAMSmain/src/resources/i18n</code>
 +
* the directory c:\temp now contains a directory i18n that contains the different language versions of the JAMS language file
 +
 +
After editing the files you can upload them to the SVN repository executing the following steps:
 +
* open a DOS command prompt
 +
* change into the directory where you have downloaded the language files before (e.g. cd c:\temp\JAMSi18n)
 +
* issue the following command, using an informative text about your editing for <code><message></code>:
 +
<code>svn ci --username jamsi18n --password jamsi18n -m <message> i18n</code>
 +
 +
You can also add new language files to the i18n directory in order to create new translations (for some basics, see [[Translating_JAMS#JAVA_localization_basics|here]]). In order to upload newly created files, you have to use the <code>svn add</code> command:
 +
<code>svn add --username jamsi18n --password jamsi18n i18n\JAMSBundle_<lcode>_<ccode>.properties</code>
 +
where <code>i18n\JAMSBundle_es.properties</code> is the new file. Finally, you again have to issue the <code>svn add</code> command in order to transfer the new file:
 +
<code>svn ci --username jamsi18n --password jamsi18n -m <message> i18n</code>

Latest revision as of 06:32, 20 November 2009

JAVA localization basics

You can translate the JAMS graphical user interfaces by editing JAMS language files. Those files contain lines of the format

<key>=<value>

where key is some string identifier and value a term in a certain language. An example would be:

ExplorerDisabled=JAMS Explorer is disabled in this version! 

The interfaces are translated by replacing the right part with the translated terms. In order to preserve a proper generation of combined terms, leading and trailing whitespace characters must be kept. The results must be stored in a file following the naming convention

<name>_<lcode>_<ccode>.properties

with the following meaning:

As an example, the proper name for a file containing brazilian portuguese language strings for JAMS would be JAMSBundle_pt_BR.properties. In general, the country code can be omitted, e.g. JAMSBundle_pt.properties is a proper file name for portuguese translations in general.

Patching existing JAMS libraries

The following instructions assume a Windows system. They look similar for other systems. In order to patch the language files of already existing JAMS libraries, proceed as follows:

  • make sure you have the JDK java development package installed
  • open a DOS command prompt
  • change into the directory containing the JAMS *.jar files (cd c:\program files\jams\lib)
  • extract the JAMS language file by running
 jar -xf jams-main.jar resources/JAMSBundle.properties
  • translate the file resources\JAMSBundle.properties, save it and rename it to resources\JAMSBundle_<lcode>_<ccode>.properties according to the conventions described above
  • write the modified file back to the archive by running
 jar -uf jams-main.jar resources/JAMSBundle_<lcode>_<ccode>.properties
  • delete the extracted files by running
 rmdir /s/q resources

On the next start of JAMS, the interface should show up with the translated terms. If not, make sure that the "Force language" entry in the JAMS properties dialog is empty. If the interface still comes up with the default localization (english), you can also force JAMS to use a localization by entering its language code in the "Force language" entry of the JAMS properties dialog. JAMS must be restarted after changing the "Force language" entry in order to correctly apply the new localization.

Uploading language files to the JAMS SVN repository

In order to make changes to JAMS language files permanent, these need to be stored in the JAMS Subversion repository. For further information about the Subversion (SVN) version control system, please have a look at these sites:

There is a huge number of different SVN clients available, have a look at http://en.wikipedia.org/wiki/Comparison_of_Subversion_clients for a probably incomplete list of them. The following steps assume that you are using the SVN command line client that comes with the SVN installation package (binary packages available here: http://subversion.tigris.org/getting.html):

  • open a DOS command prompt
  • create/change into the directory where you want to download the language files to (e.g. cd c:\temp\JAMSi18n)
  • issue the following command:
svn co --username jamsi18n --password jamsi18n http://svn.geogr.uni-jena.de/svn/jams/trunk/JAMSmain/src/resources/i18n
  • the directory c:\temp now contains a directory i18n that contains the different language versions of the JAMS language file

After editing the files you can upload them to the SVN repository executing the following steps:

  • open a DOS command prompt
  • change into the directory where you have downloaded the language files before (e.g. cd c:\temp\JAMSi18n)
  • issue the following command, using an informative text about your editing for <message>:
svn ci --username jamsi18n --password jamsi18n -m <message> i18n

You can also add new language files to the i18n directory in order to create new translations (for some basics, see here). In order to upload newly created files, you have to use the svn add command:

svn add --username jamsi18n --password jamsi18n i18n\JAMSBundle_<lcode>_<ccode>.properties

where i18n\JAMSBundle_es.properties is the new file. Finally, you again have to issue the svn add command in order to transfer the new file:

svn ci --username jamsi18n --password jamsi18n -m <message> i18n
Personal tools