Difference between revisions of "Internationalisation"

From Jmol
Jump to navigation Jump to search
m (Translating the application/applet: Subpages)
Line 64: Line 64:
 
See the [[Internationalisation/Current_Status|current status]] of the translations.
 
See the [[Internationalisation/Current_Status|current status]] of the translations.
  
 
+
Participating in the translation of the application or the applet can be achieved in several ways:
 
+
{{:Internationalisation/Online}}
=== Simple explanation to add a new translation ===
+
{{:Internationalisation/Offline}}
 
 
Adding a new translation for the Jmol application/applet is quite easy. Only a few steps are required to add the translation.
 
 
 
'''1. Download the files for the translation:'''
 
 
 
Download [http://svn.sourceforge.net/viewcvs.cgi/jmol/trunk/Jmol/src/org/jmol/translation/Jmol/Jmol.pot?view=log Jmol.pot] and rename it to {{File|''LANG''.po}}.
 
 
 
Download [http://svn.sourceforge.net/viewcvs.cgi/jmol/trunk/Jmol/src/org/jmol/translation/JmolApplet/JmolApplet.pot?view=log JmolApplet.pot] and rename it to {{File|''LANG''.po}}.
 
 
 
Note: <tt>''LANG''</tt> means your language code: e.g. <tt>de</tt> for German, <tt>fr</tt> for French and so on.
 
 
 
Note: Since both files have the same name, you will have to save them in different directories or rename them.
 
 
 
 
 
'''2. Install an editor for .po files:'''
 
 
 
The .po files can be edited with many editors, see Detailed explanation.
 
 
 
It's probably easier to use a dedicated editor, so the explanations below are based on [http://www.poedit.net/ poEdit], but feel free to use the editor you prefer.
 
poEdit is cross-platform (Windows, Unix and Mac OS X).
 
 
 
Many other editors exist:
 
* [http://i18n.kde.org/tools/kbabel/ kbabel],
 
* [http://gtranslator.sourceforge.net/ gtranslator],
 
* [http://packages.debian.org/stable/devel/gettext-el Emacs po-mode],
 
* ...
 
 
 
 
 
'''3. Configure Jmol {{File|''LANG''.po}}:'''
 
 
 
<table border="0" cellspacing="0" width="100%"><tr><td>
 
Open Jmol {{File|''LANG''.po}} with poEdit.
 
 
 
Select Catalog / Settings in the menu.
 
 
 
Type the followings values in the fields:
 
* Project name and version: Jmol
 
* Team: Your language
 
* Team's email address: [mailto:Jmol-developers@lists.sf.net Jmol-developers@lists.sf.net]
 
* Language: Your language
 
* Country: Your country
 
* Charset: UTF-8
 
 
 
Save the modifications
 
</td><td>
 
[[Image:PoEdit_Settings.png]]
 
</td></tr></table>
 
 
 
 
 
 
 
'''4. Translate Jmol {{File|''LANG''.po}}:'''
 
 
 
The main window of poEdit is divided into several areas.
 
 
 
The top area contains the list of strings to translate with their current translation. The background color of each line depends on the status of the translation:
 
* Blue: Not translated yet.
 
* Yellow: Fuzzy translation (needs verification).
 
* White: Translated.
 
* Red: Error.
 
 
 
When you select a line in the top area, the bottom areas is updated with the following:
 
* Top-left area: String to translate.
 
* Bottom-left area: Current translation. Just type your translation in here.
 
 
 
[[Image:PoEdit.png]]
 
 
 
 
 
 
 
'''5. Repeat steps 3 and 4 with JmolApplet {{File|''LANG''.po}}.'''
 
 
 
 
 
 
 
'''6. Send the two .po files to a Jmol developer, so they will be added in the next Jmol release.'''
 
 
 
Emails: [mailto:nicove@users.sourceforge.net nicove@users.sourceforge.net], [mailto:Jmol-developers@lists.sf.net Jmol-developers@lists.sf.net].
 
 
 
(sourceforge mail addresses may refuse mails with .zip attachments, so don't zip the files)
 
 
 
<hr /><br />
 
 
 
=== Simple explanation to update an existing translation ===
 
 
 
Updating an existing translation for the Jmol application/applet is quite easy. Only a few steps are required to update the translation.
 
 
 
 
 
 
 
'''1. Download the files for the translation:'''
 
 
 
Download {{File|''LANG''.po}} from the [http://svn.sourceforge.net/viewcvs.cgi/jmol/trunk/Jmol/src/org/jmol/translation/Jmol/ Jmol directory].
 
 
 
Download {{File|''LANG''.po}} from the [http://svn.sourceforge.net/viewcvs.cgi/jmol/trunk/Jmol/src/org/jmol/translation/JmolApplet/ JmolApplet directory].
 
 
 
Note: <tt>''LANG''</tt> means your language code: e.g. <tt>de</tt> for German, <tt>fr</tt> for French and so on.
 
 
 
Note: Since both files have the same name, you will have to save them in different directories or rename them.
 
 
 
 
 
 
 
'''2. Install an editor for .po files:'''
 
 
 
See step 2 in the explanations for adding a new translation.
 
 
 
 
 
 
 
'''3. Translate each {{File|''LANG''.po}}:'''
 
 
 
See step 4 in the explanations for adding a new translation.
 
 
 
 
 
 
 
'''4. Send the two .po files to a Jmol developer, so they will be added in the next Jmol release.'''
 
 
 
Emails: [mailto:nicove@users.sourceforge.net nicove@users.sourceforge.net], [mailto:Jmol-developers@lists.sf.net Jmol-developers@lists.sf.net].
 
 
 
(sourceforge mail addresses may refuse mails with .zip attachments, so don't zip the files)
 
 
 
<hr /><br />
 
 
 
=== Detailed explanation ===
 
 
 
1. Download and install [http://www.gnu.org/software/gettext/gettext.html gettext]. Linux users should try to install it using their distributions package management (like rpm, dpkg, apt, ...). Windows user download gettext from http://gnuwin32.sourceforge.net/packages/gettext.htm. Both make sure, that the gettext binaries are in your PATH environment variable.
 
 
 
'''Note for Windows users:''' If you installed the gettext binaries into e.g. {{Directory|C:\Program Files\GnuWin32}}, then you need to add <tt>C:\Program Files\GnuWin32\bin;</tt> to the existing PATH environment variable: {{MenuItem|Control Panel}} &rarr; {{MenuItem|System}} &rarr; {{MenuItem|Environment Variable}} (Tab Extended) OR run the following command in a windows command shell: <tt>set PATH=%PATH%;C:\Program Files\GnuWin32\bin;.</tt>. Windows XP and Windows 2000 are currently supported.
 
 
 
 
 
 
 
2. All targets related to internationalisation and localisation issues are part of {{File|build-i18n.xml}}. To create PO-template files, run <tt>ant -f build-i18n.xml update-pot</tt>. All {{File|''LANG''.po}} files (which contain the translation and are maintained by the translator himself) are updated with <tt>ant -f build-i18n.xml update-po</tt>. To create the final message catalogs, run <tt>ant -f build-i18n.xml update-catalog</tt>.
 
 
 
 
 
 
 
3. To create a translation in your language, go to {{Directory|src/org/jmol/translation/Jmol}} (for the application) or {{Directory|src/org/jmol/translation/JmolApplet}} (for the applet) and copy {{File|Jmol(Applet).pot}} to {{File|''LANG''.po}} - <tt>''LANG''</tt> means your language code: e.g. <tt>de</tt> for German, <tt>fr</tt> for French and so on.
 
 
 
 
 
 
 
4. To begin your translation, open the newly created {{File|''LANG''.po}} with an editor of your choice - '''Windows users be aware, that the editor MUST NOT add any control characters (like e.g. Word does)!.''' There are also specialised editors for this work: e.g. [http://www.poedit.net/ poedit], [http://i18n.kde.org/tools/kbabel/ kbabel], or [http://gtranslator.sourceforge.net/ gtranslator].
 
 
 
 
 
 
 
5. The opened file will look like this:
 
 
 
# SOME DESCRIPTIVE TITLE.
 
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
 
# This file is distributed under the same license as the PACKAGE package.
 
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
 
#
 
 
 
These lines are '''comments'''. Adjust them and add a descritpive title, the right copyright and your name as author. Be aware, that lines beginning with #, or #: have a special meaning and are not normal comments.
 
 
 
#, fuzzy
 
msgid ""
 
msgstr ""
 
"Project-Id-Version: PACKAGE VERSION\n"
 
"Report-Msgid-Bugs-To: jmol-developers@lists.sourceforge.net\n"
 
"POT-Creation-Date: 2005-06-01 02:02+0200\n"
 
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 
"Language-Team: LANGUAGE <LL@li.org>\n"
 
"MIME-Version: 1.0\n"
 
"Content-Type: text/plain; charset=UTF-8\n"
 
"Content-Transfer-Encoding: 8bit\n"
 
 
 
We call this part the '''po-headers'''. The line <tt>#, fuzzy</tt> says, that the headers are outdated. Customise <tt>"Project-Id-Version: PACKAGE VERSION\n"</tt>, <tt>"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"</tt>, <tt>"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"</tt> and maybe <tt>"Language-Team: LANGUAGE <LL@li.org>\n"</tt> (if you don't belong to a language team, then write <tt>none</tt>) and remove the fuzzy comment. In '''every case''' make sure, that <tt>Content-Type</tt> and <tt>Content-Transfer-Encoding</tt> are right (if possible, use <tt>UTF-8</tt>).
 
 
 
If you plan to use [http://www.poedit.net/ poedit] to do the translation, you can add several lines to the headers (replace <tt>LANGUAGE</tt> and <tt>COUNTRY</tt>).
 
 
 
"X-Poedit-Language: LANGUAGE\n"
 
"X-Poedit-Country: COUNTRY\n"
 
"X-Poedit-Basepath: ../../../..\n"
 
 
 
Then begin the "real" translation:
 
 
 
#: org/openscience/jmol/app/AboutDialog.java:57
 
#: org/openscience/jmol/app/GuiMap.java:155
 
msgid "About Jmol"
 
msgstr ""
 
 
#: org/openscience/jmol/app/AboutDialog.java:67
 
#: org/openscience/jmol/app/HelpDialog.java:77
 
#: org/openscience/jmol/app/WhatsNewDialog.java:68
 
#, java-format
 
msgid "Unable to find url \"{0}\"."
 
msgstr ""
 
[..]
 
 
 
A line or block beginning with <tt>msgid</tt> contains the untranslated (or original) string inside double quotation marks. Above this line, you see the location entries <tt>#: path/to/file.java:line</tt> (where the string can be found in the source) and sometimes some special comments <tt>#, java-format</tt> or <tt>#, fuzzy</tt> or even <tt>#, fuzzy, java-format</tt> (telling you more about the format of a string or the state of a translation) - these lines are added and changed automatically by running <tt>ant -f build-i18n.xml update-po</tt>. Place your translation into the line or block beginning with <tt>msgstr</tt> and inside double quotation marks.
 
 
 
 
 
 
 
6. After finishing, add your translation ({{File|''LANG''.po}}) to Jmol SVN and your language code to property <tt>all.Jmol(Applet).languages</tt> in {{File|build-i18n.xml}}.
 
 
 
 
 
 
 
7. At the end of this short howto, we should speak about special situations and a few hints, you should consider:
 
* double quotation marks inside a string must be escaped with a backslash: <tt>msgstr "... \" ..."</tt>
 
* single quotation marks must be doubled (two single quotation marks) for Java texts (<tt>#, java-format</tt>)
 
* <tt>#, fuzzy</tt> means that the translation string is outdated (e.g. the original string changed) - in this situation, check your translation and adjust it if necessary - then you can remove the fuzzy string (e.g. line <tt>#, fuzzy, java-format</tt> becomes <tt>#, java-format</tt>)
 
  
 
<hr /><br />
 
<hr /><br />

Revision as of 10:53, 5 April 2008

Jmol/JSmol Development

Jmol Internationalisation and Localisation

Several pieces of Jmol can be translated into your local language:



Translating this Wiki

The articles in this Wiki can be translated into your own language.

The explanation below will take two different situations:

  • When the page you want to translate is already translated into an other language.
  • When the page you want to translate is not translated into any other language.

We will suppose in the explanation that you want to translate a page named English_Page into XXXXX (language code: xx).


Page already translated into an other language

  • In the Template namespace, edit the existing page Lang:English_Page, add your language in it and save the page:
----
{| border="0" cellspacing="1"
|-
! valign="middle" | [[Image:Geographylogo.png]]
| valign="middle" align="left" | <span style="font-size:smaller">
Reference:
'''[[English_Page|English]]''' – 
Other:
<!--es-->[[English_Page/es|Español]] · 
<!--fr-->[[English_Page/fr|Français]] · 
<!--xx-->[[English_Page/xx|XXXXX]] · 
</span>
|}
----
  • Edit the English_Page to have the source code of the page, copy the entire source code (Ctrl+A, Ctrl+C) and cancel the page editing.
  • Start editing the page in your language (English_Page/xx), paste the source code (Ctrl+V) and then translate the page.


Page not translated into any other language

  • Edit the template page (Template:Lang:English_Page) and initialize it:
----
{| border="0" cellspacing="1"
|-
! valign="middle" | [[Image:Geographylogo.png]]
| valign="middle" align="left" | <span style="font-size:smaller">
Reference:
'''[[English_Page|English]]''' – 
Other:
<!--xx-->[[English_Page/xx|XXXXX]] · 
</span>
|}
----
  • Edit the English_Page, insert {{Lang:English_Page}} at the beginning, copy the entire source code (Ctrl+A, Ctrl+C) and save the page.
  • Start editing the page in your language (English_Page/xx), paste the source code (Ctrl+V) and then translate the page.


Translating the application/applet

In Jmol version 10.00.12 we changed from an unhandy (but well-known) translation process to a more powerful one using GNU's gettext suite. The following paragraphs contain a detailed explanation of this process. More documentation is available here.

See the current status of the translations.

Participating in the translation of the application or the applet can be achieved in several ways:


Geographylogo.png

Reference: English – Other: 日本語 ·


  • Online: by editing directly the translation through Launchpad web site. You just need to register but no installation is required.
    • Description needs to be completed when everything is setup on the Launchpad web site

Geographylogo.png

Reference: English – Other: 日本語 ·




Translating the Applet-, User- and Developers-Guide

The guides are written in XML. ...


1. First install and download:

Note for Linux users: Linux users should ALWAYS try to use their package management to install (software-)packages.

Note for Windows users: Windows users MUST add an environment variable PYTHON_PATH, which contains the directory where you installed Python, e.g. set PYTHON_PATH=C:\Program Files\Python24.

Now you are done with the prerequisites.


2. All targets related to internationalisation and localisation of the documentation are part of File icon.gifbuild-doc-i18n.xml. To create PO-template files, run ant -f build-doc-i18n.xml create-pot. All File icon.gifJmol*Guide.LANG.po files (which contain the translation and are maintained by the translator himself) are updated with ant -f build-doc-i18n.xml update-po. To create the final (translated) XML file File icon.gifJmol*Guide_LANG.docbook.xml, run ant -f build-doc-i18n.xml update-xml.


3. To create a translation in your language, go to doc/source/po and copy File icon.gifJmol*Guide.pot to File icon.gifJmol*Guide.LANG.po - LANG means your language code: e.g. de for German, fr for French and so on.


4. The rest is similar to the above Howto.



Translating the Jmol and FAH websites

... to write