Difference between revisions of "Internationalisation"
m (updated poEdit link) |
(→Page not translated into any other languages: Some explanation same as the Japanese page version 2015/1/20 (Thu) 05:52 (UTC) was added.) |
||
(15 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | ''' Jmol | + | {{Jmol Development Sections}} |
+ | = Jmol Internationalisation and Localisation = | ||
+ | |||
+ | {{Lang:Internationalisation}} | ||
+ | |||
+ | '''`Internationalisation´''' is the process of designing software so that it can be adapted to various languages and regions without engineering changes. '''`Localisation´''' is the process of adapting software for a specific region or language by adding locale-specific components and translating text. | ||
+ | |||
+ | __TOC__ | ||
+ | |||
+ | = Internationalisation = | ||
+ | |||
+ | :''This is meant for developers only'' | ||
+ | |||
+ | == Application and Applet == | ||
+ | |||
+ | In Jmol version 10.00.12 we changed from an unhandy (but well-known) translation process to a more powerful one using [http://www.gnu.org/software/gettext/gettext.html GNU's gettext] suite. The localisation section below contains a detailed explanation of this process. More documentation is available in [http://www.gnu.org/software/gettext/manual/ the gettext manual]. | ||
+ | |||
+ | === Coding === | ||
+ | All text fragments are called in the code like this: | ||
+ | GT._("Here the English text") | ||
+ | |||
+ | |||
+ | ''Special case:'' | ||
+ | :When the text includes a variable word or phrase that comes from an external source (somewhere else in the code, which changes depending on the current situation), you should account for it in this way: | ||
+ | GT._("Here the number {0} English text",someVariable) | ||
+ | :The value of ''someVariable'' will be inserted at the position of ''{0}'', so it might render, e.g., as | ||
+ | :: Here the number 1 English text | ||
+ | :: Here the number 2 English text | ||
+ | :: etc. | ||
+ | :This is needed since the position of that word may be different in different languages. Translators should leave the {0} token as is but put it in the proper place. For example, Spanish translation would be: | ||
+ | :: <code>"Aquà va el texto en español número {0}"</code> | ||
+ | :: Aquà va el texto en español número 1 | ||
+ | :: Aquà va el texto en español número 2 | ||
+ | :: etc. | ||
+ | : If more than one such words are needed, use {0}, {1}, etc., and the code changes a little bit, like in: | ||
+ | GT._("The user {0} has an id of {1} for this session.", | ||
+ | new String[]{ userName,sessID }) | ||
+ | |||
+ | |||
+ | ''Comments for translators:'' | ||
+ | :If the text isn't self explanatory for the translators, a comment can be added for helping them understanding the context. | ||
+ | :Use Java comments with the syntax <code>/// TRANSLATORS: explanation</code> (''note the '''3''' slashes'') just before the call to <code>GT._(...)</code>. | ||
+ | :This comments will be included in the gettext files and will be visible by translators. | ||
+ | /// TRANSLATORS: first line of explanation | ||
+ | /// Second line of explanation | ||
+ | GT._("The user {0} has an id of {1} for this session.", | ||
+ | new String[]{ userName,sessID }) | ||
+ | |||
+ | = Localisation = | ||
Several pieces of Jmol can be translated into your local language: | Several pieces of Jmol can be translated into your local language: | ||
− | |||
− | + | You can check the [[Internationalisation/Current_Status|current status of translations]]. | |
+ | |||
+ | <br /> | ||
== Translating this Wiki == | == Translating this Wiki == | ||
Line 17: | Line 66: | ||
− | === Page already translated into | + | === Page already translated into another language === |
* In the [http://wiki.jmol.org/index.php?title=Special%3AAllpages&from=&namespace=10 Template namespace], edit the existing page <tt>Lang:English_Page</tt>, add your language in it and save the page: | * In the [http://wiki.jmol.org/index.php?title=Special%3AAllpages&from=&namespace=10 Template namespace], edit the existing page <tt>Lang:English_Page</tt>, add your language in it and save the page: | ||
Line 38: | Line 87: | ||
− | === Page not translated into any other | + | === Page not translated into any other languages === |
* Edit the template page (<tt>Template:Lang:English_Page</tt>) and initialize it: | * Edit the template page (<tt>Template:Lang:English_Page</tt>) and initialize it: | ||
Line 53: | Line 102: | ||
|} | |} | ||
----</nowiki> | ----</nowiki> | ||
+ | :* xx indicates the language code (e.g. ja) | ||
+ | :* XXXXX indicates the language name in the designated language (e.g. æ¥æ¬èª) | ||
* Edit the <tt>English_Page</tt>, insert <tt><nowiki>{{Lang:English_Page}}</nowiki></tt> at the beginning, copy the entire source code (<tt>Ctrl+A</tt>, <tt>Ctrl+C</tt>) and save the page. | * Edit the <tt>English_Page</tt>, insert <tt><nowiki>{{Lang:English_Page}}</nowiki></tt> at the beginning, copy the entire source code (<tt>Ctrl+A</tt>, <tt>Ctrl+C</tt>) and save the page. | ||
* Start editing the page in your language (<tt>English_Page/xx</tt>), paste the source code (<tt>Ctrl+V</tt>) and then translate the page. | * Start editing the page in your language (<tt>English_Page/xx</tt>), paste the source code (<tt>Ctrl+V</tt>) and then translate the page. | ||
− | + | <br /> | |
+ | |||
== Translating the application/applet == | == Translating the application/applet == | ||
− | |||
− | |||
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}} | ||
+ | {{:Internationalisation/Offline}} | ||
+ | * A few items in the application cannot be translated by any of these two methods, and need a special procedure. See [[Internationalisation/Translating_html_files|Translating html files]]. | ||
+ | === Translation of the ''Export to Web'' module === | ||
− | + | Although this module is part of the application, and therefore instructions above are applicable, there are some special characteristics that call for some precautions and a partially different procedure. | |
− | + | * See [[Internationalisation/Offline/Export_to_Web|Translating the Export to Web module]]. | |
− | + | <br /> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Translating the Applet-, User- and Developers-Guide == | == Translating the Applet-, User- and Developers-Guide == | ||
The guides are written in XML. ... | The guides are written in XML. ... | ||
− | |||
Line 272: | Line 137: | ||
* [http://ftp.gnome.org/pub/GNOME/sources/gnome-doc-utils/ gnome-doc-utils] - '''only''' Linux users, the Python scripts in Jmol-HEAD\doc\source are ('''only!''') for Windows users | * [http://ftp.gnome.org/pub/GNOME/sources/gnome-doc-utils/ gnome-doc-utils] - '''only''' Linux users, the Python scripts in Jmol-HEAD\doc\source are ('''only!''') for Windows users | ||
− | ''' | + | '''Linux users:''' you should '''ALWAYS''' try to use youir package management to install (software-)packages. |
− | ''' | + | '''Windows users:''' you '''MUST''' add an environment variable <tt>PYTHON_PATH</tt>, which contains the directory where you installed Python, e.g. <tt>set PYTHON_PATH=C:\Program Files\Python24</tt>. |
Now you are done with the prerequisites. | Now you are done with the prerequisites. | ||
− | |||
2. All targets related to internationalisation and localisation of the documentation are part of {{File|build-doc-i18n.xml}}. To create PO-template files, run <tt>ant -f build-doc-i18n.xml create-pot</tt>. All {{File|Jmol*Guide.''LANG''.po}} files (which contain the translation and are maintained by the translator himself) are updated with <tt>ant -f build-doc-i18n.xml update-po</tt>. To create the final (translated) XML file {{File|Jmol*Guide_''LANG''.docbook.xml}}, run <tt>ant -f build-doc-i18n.xml update-xml</tt>. | 2. All targets related to internationalisation and localisation of the documentation are part of {{File|build-doc-i18n.xml}}. To create PO-template files, run <tt>ant -f build-doc-i18n.xml create-pot</tt>. All {{File|Jmol*Guide.''LANG''.po}} files (which contain the translation and are maintained by the translator himself) are updated with <tt>ant -f build-doc-i18n.xml update-po</tt>. To create the final (translated) XML file {{File|Jmol*Guide_''LANG''.docbook.xml}}, run <tt>ant -f build-doc-i18n.xml update-xml</tt>. | ||
− | |||
Line 287: | Line 150: | ||
+ | 4. The rest is similar to the above Howto. | ||
− | |||
− | + | <br /> | |
== Translating the Jmol and FAH websites == | == Translating the Jmol and FAH websites == | ||
... to write | ... to write |
Latest revision as of 06:02, 20 January 2015
- Getting Involved in J(S)mol evolution
- Release Procedures
- Important! Use the Jmol Coding Style
- Developing J(S)mol with Eclipse
- Internationalisation (status)
- ProgrammeerZomer / SummerOfCode
- MultiUser Jmol
- Developer mailing list (mirror)
Jmol Internationalisation and Localisation
`Internationalisation´ is the process of designing software so that it can be adapted to various languages and regions without engineering changes. `Localisation´ is the process of adapting software for a specific region or language by adding locale-specific components and translating text.
Contents
Internationalisation
- This is meant for developers only
Application and 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 localisation section below contains a detailed explanation of this process. More documentation is available in the gettext manual.
Coding
All text fragments are called in the code like this:
GT._("Here the English text")
Special case:
- When the text includes a variable word or phrase that comes from an external source (somewhere else in the code, which changes depending on the current situation), you should account for it in this way:
GT._("Here the number {0} English text",someVariable)
- The value of someVariable will be inserted at the position of {0}, so it might render, e.g., as
- Here the number 1 English text
- Here the number 2 English text
- etc.
- This is needed since the position of that word may be different in different languages. Translators should leave the {0} token as is but put it in the proper place. For example, Spanish translation would be:
"Aquà va el texto en español número {0}"
- Aquà va el texto en español número 1
- Aquà va el texto en español número 2
- etc.
- If more than one such words are needed, use {0}, {1}, etc., and the code changes a little bit, like in:
GT._("The user {0} has an id of {1} for this session.", new String[]{ userName,sessID })
Comments for translators:
- If the text isn't self explanatory for the translators, a comment can be added for helping them understanding the context.
- Use Java comments with the syntax
/// TRANSLATORS: explanation
(note the 3 slashes) just before the call toGT._(...)
. - This comments will be included in the gettext files and will be visible by translators.
/// TRANSLATORS: first line of explanation /// Second line of explanation GT._("The user {0} has an id of {1} for this session.", new String[]{ userName,sessID })
Localisation
Several pieces of Jmol can be translated into your local language:
You can check the current status of translations.
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 another 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 languages
- 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> |} ----
- xx indicates the language code (e.g. ja)
- XXXXX indicates the language name in the designated language (e.g. æ¥æ¬èª)
- 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
See the current status of the translations.
Participating in the translation of the application or the applet can be achieved in several ways:
- 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
- Offline: by editing the LANG.po files on you computer and sending them back by mail to nicove@users.sourceforge.net or Jmol-developers@lists.sf.net. You need to install an editor for .po files on your computer.
- A few items in the application cannot be translated by any of these two methods, and need a special procedure. See Translating html files.
Translation of the Export to Web module
Although this module is part of the application, and therefore instructions above are applicable, there are some special characteristics that call for some precautions and a partially different procedure.
Translating the Applet-, User- and Developers-Guide
The guides are written in XML. ...
1. First install and download:
- Python runtime
- libxml2-python bindings (Windows-port)
- gettext (Windows-port) - see also the first paragraphs in Translating the application/applet
- gnome-doc-utils - only Linux users, the Python scripts in Jmol-HEAD\doc\source are (only!) for Windows users
Linux users: you should ALWAYS try to use youir package management to install (software-)packages.
Windows users: you 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 build-doc-i18n.xml. To create PO-template files, run ant -f build-doc-i18n.xml create-pot. All Jmol*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 Jmol*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 Jmol*Guide.pot to Jmol*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
Contributors
NicolasVervelle, AngelHerraez, Vslavik, Pimpim, Bevmorguson, Cudo29