GRASS messages translation: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(add link to https://github.com/OSGeo/grass-addons/blob/master/tools/transifex_merge.sh)
(→‎Weblate: technical background on the installation: GRASS GIS related Weblate troubleshooting)
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Help page translations ==
* For translations of full help (man) pages see [[Updating GRASS Documentation#Translations]]
== GRASS messages translation project ==
== GRASS messages translation project ==


Line 18: Line 14:
Simple Chinese, Swahili, Hindi, Greek, Tamil, Russian, Telugu, Português, ... Please join us!
Simple Chinese, Swahili, Hindi, Greek, Tamil, Russian, Telugu, Português, ... Please join us!


== How to change the language ==
== Weblate translation platform ==


* see [[GRASS_messages_translation#Testing_different_languages|Testing different languages]] below.
Weblate is a web-based translation tool with tight version control integration. It features a simple and clean user interface, propagation of translations across components, quality checks and automatic linking to source files.


== How to start or update translations ==
(Note that we migrated from Transifex to [https://weblate.osgeo.org/projects/grass-gis/ Weblate] in 2023. All messages on Transifex have been transferred to Weblate.)
 
=== How to translate ===
'''''NOTE: THIS IS FOR TRANSLATOR'''''


* For terminology, please refer to the [[GRASS Translation Glossary]].
* For terminology, please refer to the [[GRASS Translation Glossary]].


=== Files to be edited (downloaded) ===
Register yourself on the [https://weblate.osgeo.org/projects/grass-gis/ Weblate website] using the [https://www.osgeo.org/community/getting-started-osgeo/osgeo_userid/ OSGeo-ID], and start to translate (grasswxpy is the GUI translation and it should be the first translated).


==== GRASS GIS 6 ====
=== Using the machine translation tool ===
In GRASS GIS 6, we have 5 types of .po files per language (the files are stored in the source code, in directory locale/po/; <br>
 
or simply '''[http://svn.osgeo.org/grass/grass/branches/releasebranch_6_4/locale/po/ download .po files here]'''):
Using the machine translation tool: We have added the DeepL.com API which helps for selected languages to come to speed with translations.
 
Usage: login to Weblate. Then you see a button "Automatic suggestion". Use "Clone Translation" to copy over the suggested translation, edit as needed and save it.
 
[[File:Weblate with machine translation DeepL.png|thumb|800px|center|alt=Weblate with machine translation DeepL.com API|Weblate with machine translation DeepL.com API]]
 
=== Automated upload of your translation work to the GRASS GIS project in GitHub ===
 
Every 24 hours the new translations are automatically pushed to https://github.com/OSGeo/grass/pulls.
One of the maintainers will take care to merge them into the code so that it becomes part of the next release.
 
=== Files to be edited ===
 
==== GRASS GIS 8 translations ====
In GRASS GIS 8, we have only 3 types of .po files per language (the files are stored in the source code, in directory locale/po/):
 
<!--
Weblate widgets for embedding into other sites: https://weblate.osgeo.org/widgets/grass-gis/
-->
 
<center>
[[Image:Weblate grassgis widget.png|center|link=https://weblate.osgeo.org/projects/grass-gis/]]
(click to see the GRASS GIS Weblate pages)
</center>


* <tt>grasslibs_LANG.po</tt>: messages from libraries
* <tt>grasslibs_LANG.po</tt>: messages from libraries
* <tt>grassmods_LANG.po</tt>: messages from commands ("modules")
* <tt>grassmods_LANG.po</tt>: messages from commands ("modules")
* <tt>grassnviz_LANG.po</tt>: messages from NVIZ Tcl/Tk graphical user interface (GRASS 6)
* <tt>grasstcl_LANG.po</tt>: messages from Tcl/Tk graphical user interface (GRASS 6)
* <tt>grasswxpy_LANG.po</tt>: messages from wxgrass/wxPython graphical user interface
* <tt>grasswxpy_LANG.po</tt>: messages from wxgrass/wxPython graphical user interface


where "LANG" in the above file names is a two character code which indicates the language. It is based on the Alpha-2 code of [http://www.loc.gov/standards/iso639-2/php/English_list.php ISO 639-1] (right column). Example: <tt>grasswxpy_pl.po</tt> for Polish.
where "LANG" in the above file names is a two character code which indicates the language. It is based on the Alpha-2 code of [http://www.loc.gov/standards/iso639-2/php/English_list.php ISO 639-1] (right column). Example: <tt>grasswxpy_pl.po</tt> for Polish.


==== GRASS GIS 7 ====
'''We highly recommend to use our Weblate server: https://weblate.osgeo.org/projects/grass-gis/'''!
In GRASS GIS 7, we have only 3 types of .po files per language (the files are stored in the source code, in directory locale/po/; <br>
 
or simply '''[http://svn.osgeo.org/grass/grass/branches/releasebranch_7_0/locale/po/ download .po files here]'''):
=== Weblate: technical background on the installation ===
 
'''How it works:''' when a developer makes a GRASS GIS repo commit on GitHub, GitHub then calls the [https://github.com/OSGeo/grass/pull/3065#issuecomment-1716446226 webhook] on Weblate which triggers a refresh of Weblate's git fork of the GRASS GIS repo (check at ​https://github.com/osgeoweblate/grass/tree/weblate-grass-gis-grasslibs).
 
For pushing translations back to GitHub, there is a setting in Weblate for that which defaults to 24 hrs (accumulates translations over a day). Then a pull request with the translations will be opened in the GRASS GIS GitHub repo.
 
For technical background on the OSGeo Weblate installation, see https://wiki.osgeo.org/wiki/SAC:Weblate .
 
For GRASS GIS related Weblate troubleshooting, see the discussion in this OSGeo-SAC ticket: https://trac.osgeo.org/osgeo/ticket/2981


* <tt>grasslibs_LANG.po</tt>: messages from libraries
'''Weblate Troubleshooting:'''
* <tt>grassmods_LANG.po</tt>: messages from commands ("modules")
 
* <tt>grasswxpy_LANG.po</tt>: messages from wxgrass/wxPython graphical user interface
In case the Weblate's git copy of the GRASS GIS repo does no longer update due to
a conflict or whatever reason:


where "LANG" in the above file names is a two character code which indicates the language. It is based on the Alpha-2 code of [http://www.loc.gov/standards/iso639-2/php/English_list.php ISO 639-1] (right column). Example: <tt>grasswxpy_pl.po</tt> for Polish.
Log into Weblate (requires administrator rights) and check on <https://weblate.osgeo.org/projects/grass-gis/#repository>
click on the "Manage" -> "Repository Maintenance". Therein choose "Update" button,
"Update with merge without fast-forward". If successful, this will create
another pull request in the GRASS GIS repo (trigger with "Push" button).


=== Continuing an existing translation ===
=== Continuing an existing translation ===
Line 58: Line 90:
Then get these four .po files for your language and start. If a file is missing, just ask on the list to get it generated or see next section. To get these .po files (the files are in the directory locale/po/):
Then get these four .po files for your language and start. If a file is missing, just ask on the list to get it generated or see next section. To get these .po files (the files are in the directory locale/po/):


* either [http://svn.osgeo.org/grass/grass/branches/releasebranch_7_0/locale/po/ download current .po files] directly from SVN (click on file name to download),
* either [https://github.com/OSGeo/grass/tree/master/locale/po/ download current .po files] directly from SVN (click on file name to download),
* or [http://trac.osgeo.org/grass/wiki/DownloadSource#GRASS7.0 download source code package] from SVN,
* or [https://grass.osgeo.org/download/0 download source code package] from GitHub,
* or download the recent [http://grass.osgeo.org/grass70/source/snapshot/ source code snapshot],
* or download the recent [https://grass.osgeo.org/grass78/source/snapshot/ source code snapshot],
* or ask on the [http://lists.osgeo.org/mailman/listinfo/grass-translations GRASS translations mailing list] for these files.
* or ask on the [https://lists.osgeo.org/mailman/listinfo/grass-translations GRASS translations mailing list] for these files.


Then edit the files with a .po file editor (poEDIT or kbabel or..., see below). Take care to maintain layout and special characters. And '''submit often''' - if you wait for weeks, the messages may already be outdated and your time wasted. Just keep in touch on the [http://lists.osgeo.org/mailman/listinfo/grass-translations GRASS translations mailing list]!
Then edit the files with a .po file editor (poEDIT or kbabel or..., see below). Take care to maintain layout and special characters. And '''submit often''' - if you wait for weeks, the messages may already be outdated and your time wasted. Just keep in touch on the [https://lists.osgeo.org/mailman/listinfo/grass-translations GRASS translations mailing list]!


=== Starting a new translation ===
=== Starting a new translation ===
Line 69: Line 101:
The language you want isn't yet there? Read on.
The language you want isn't yet there? Read on.


Briefly, the steps to create new messages files are (if you find this too complicated, ask on the [http://lists.osgeo.org/mailman/listinfo/grass-translations GRASS translations mailing list] to get these files done for you!):
Briefly, the steps to create new messages files are (if you find this too complicated, ask on the [https://lists.osgeo.org/mailman/listinfo/grass-translations GRASS translations mailing list] to get these files done for you!):


# Get the latest source code development version from either the SVN repository or as SVN snapshot (see [http://grass.osgeo.org/download/index.php Download]).
# Get the latest source code development version from either the SVN repository or as SVN snapshot (see [https://grass.osgeo.org/download/ Download]).
# run: './configure --with-nls [... other parameters]' to configure the GRASS source code  
# run: './configure --with-nls [... other parameters]' to configure the GRASS source code  
# run: 'cd locale' to change into the translation directory
# run: 'cd locale' to change into the translation directory
Line 86: Line 118:


From time to time messages need to be updated from the originals. This is usually done by the GRASS translation manager.
From time to time messages need to be updated from the originals. This is usually done by the GRASS translation manager.
== Software to translate: .po file editors ==
* [http://userbase.kde.org/Lokalize Lokalize]: (previously KBabel) is a set of tools for editing and managing gettext PO files, cross-platform, comes with KDE SC (works also under MS-Windows)
* [http://www.poedit.net/download.php poEdit]: poEdit is  gettext catalogs (.po files) editor (works also under MS-Windows)
* [http://translate.sourceforge.net/wiki/virtaal/index Virtaal] Virtaal is cross-platform graphical translation tool with terminology help from [http://open-tran.eu Open-Tran.eu]
* '''[https://www.transifex.com/grass-gis/grass7/ Web based solution Transifex]''' (''see below, join us!'')
* [http://www.omegat.org/ Java based solution OmegaT]
<!--
'''How to use Transifex to translate messages online in a browser:'''
[[Image:Transifex register signin.png|center|450px|Register and sign in]]
[[Image:Transifex edit online.png|center|450px|Click to edit online]]
-->
== Transifex ==
=== How to translate ===
'''''NOTE: THIS IS FOR TRANSLATOR'''''
Register your self on [https://www.transifex.com/ Transifex website], join the [https://www.transifex.com/grass-gis/ GRASS GIS project] and start to translate (grasswxpy is the GUI translation and it should be the first translated).


=== Create a new project ===
=== Create a new project ===
Line 113: Line 123:
'''''NOTE: CORE DEVELOPERS ONLY!'''''
'''''NOTE: CORE DEVELOPERS ONLY!'''''


A project should be done for each stable release, only an Organization Administrators can create a project. From the dashboard in the left bottom corner there is "'''New project'''" button. Fill all the field in the form. More info in [https://docs.transifex.com/projects/creating-a-project Transifex documentation]
TODO 2023: improve this section!
 
A project should be done for each stable release, only an Organization Administrators can create a project. From the dashboard in the left bottom corner there is "'''New project'''" button. Fill all the field in the form. More info in [https://docs.weblate.org/en/latest/ Weblate documentation]


Once the new project is created you need to upload the resources (the pot file to translate).
Once the new project is created you need to upload the resources (the pot file to translate).
Line 119: Line 131:
   make pot
   make pot


inside the '''locale''' folder. Now you can load in the Resource section, after you added them you can link the pot file with an online version to get updates. To do this click on "'''Auto update resources'''" bottom (read also the [https://docs.transifex.com/projects/uploading-content Transifex documentation].
inside the '''locale''' folder. Now you can load in the Resource section, after you added them you can link the pot file with an online version to get updates. To do this click on "'''Auto update resources'''" bottom (read also the [https://docs.weblate.org/en/latest/ Weblate documentation].


At this point you need to load the translated po files, for each language and file you have to upload the translation po file. Some errors could appear, resolution of this problems is a TODO
At this point you need to load the translated po files, for each language and file you have to upload the translation po file. Some errors could appear, resolution of this problems is a TODO
Line 127: Line 139:
'''''NOTE: THIS IS FOR DEVELOPERS OR POWER USERS'''''
'''''NOTE: THIS IS FOR DEVELOPERS OR POWER USERS'''''


==== Setup of transifex client ====
== Testing different languages in GRASS GIS ==
It is possible to retrieve back the translated po files automatically using the [https://docs.transifex.com/client/introduction Transifex client] which you need to install first.
 
To download the message files it is required to create a folder to initialize the Transifex project using the command, so enter in the locale folder of your GRASS source code and create a new folder called transifex:
 
mkdir transifex
cd transifex
tx init [--user=USERNAME --passwd=PASSWORD]
 
Instead of specifying the --user and --passwd options on command line, it is recommended to create the ''.transifexrc'' file in your $HOME directory:
 
<pre>
[https://www.transifex.com]
hostname = https://www.transifex.com
password = YOUR_PASSWORD
username = YOUR_USERNAME
</pre>
 
At this point you need to configure the GRASS GIS messages repository by modifying the ''.tx/config'' file created in the locale/transifex/ folder. The following file is for the [https://www.transifex.com/grass-gis/grass72 GRASS 7.2 project]. Note that a section for each resource has to be added:
 
<pre>
[main]
host = https://www.transifex.com
 
[grass72.grasslibspot]
type = PO
source_lang = en
source_file = ../templates/grasslibs.pot
 
[grass72.grassmodspot]
type = PO
source_lang = en
source_file = ../templates/grassmods.pot
 
[grass72.grasswxpypot]
type = PO
source_lang = en
source_file = ../templates/grasswxpy.pot
</pre>
 
==== Using of the transifex client ====
'''''NOTE: THIS SHOULD NOT BE RUN IF YOU WANT TO RUN transifex_merge.sh (you can find it in [https://github.com/OSGeo/grass-addons/blob/master/tools/transifex_merge.sh grass-addons/tools/]) '''''
 
Now you can download all the translated po files with the following command
 
tx pull -a
 
== Testing different languages ==


Testing different languages requires that the respective language environment and, if needed, fonts are installed.
Testing different languages requires that the respective language environment and, if needed, fonts are installed.
Line 205: Line 170:
=== Creating startup scripts for different languages ===
=== Creating startup scripts for different languages ===


GRASS in English language, save as "grass64eng" (executable flag set, store in path):
GRASS in English language, save as "grass78eng" (executable flag set, store in path):
       #!/bin/sh
       #!/bin/sh
       export LANG=en_US
       export LANG=en_US
       export LANGUAGE=en_US
       export LANGUAGE=en_US
       export LC_MESSAGES=en_US
       export LC_MESSAGES=en_US
       exec grass64 "$@"
       exec grass78 "$@"


GRASS in Japanese language, save as "grass64ja" (executable flag set, store in path):
GRASS in Japanese language, save as "grass78ja" (executable flag set, store in path):
       #!/bin/sh
       #!/bin/sh
       export LANG=ja_JA.UTF-8
       export LANG=ja_JA.UTF-8
       export LANGUAGE=ja_JA.UTF-8
       export LANGUAGE=ja_JA.UTF-8
       export LC_MESSAGES=ja_JA.UTF-8
       export LC_MESSAGES=ja_JA.UTF-8
       grass64 "$@"
       grass78 "$@"


== Coordination among translators ==
== Coordination among translators ==


If several translators work on the same language files, obviously some coordination is needed. Please announce work via the "translations" mailing list at http://lists.osgeo.org/mailman/listinfo/grass-translations  
If several translators work on the same language files, obviously some coordination is needed. Please announce work via the "translations" mailing list at https://lists.osgeo.org/mailman/listinfo/grass-translations  


Also the translation manager is listening there to the upload the changed files into the GRASS source code repository.
Also the translation manager is listening there to the upload the changed files into the GRASS source code repository.
Line 227: Line 192:
== Best practices ==
== Best practices ==


* Italiano: [http://tp.linux.it/buona_traduzione.html Regole per la buona traduzione]
* Italiano: [https://tp.linux.it/buona_traduzione.html Regole per la buona traduzione]


== Installation of language packages ==
== Installation of language packages ==
Line 233: Line 198:
Example: Chinese
Example: Chinese


* Mandriva: urpmi locales-zh kde-l10n-zh_CN fonts-ttf-default-zh_CN
* Debian, Fedora, Ubuntu, ...: the locales should be already present
* Fedora: the locales should be already present
** list all valid locales on the system: localectl list-locales
** list all valid locales on the system: localectl list-locales
** show current settings: localectl status
** show current settings: localectl status
Line 243: Line 207:
Please re-use existing messages:
Please re-use existing messages:
* https://trac.osgeo.org/grass/wiki/MessageStandardization
* https://trac.osgeo.org/grass/wiki/MessageStandardization
'''Idea''': use [https://pypi.python.org/pypi/python-Levenshtein/ python-Levenshtein] or similar to identify very similar messages (and clean them up)


== Updating messages in the source code ==
== Updating messages in the source code ==
Line 273: Line 235:
* fprintf(stdout...) output is usually send to pipe or file.
* fprintf(stdout...) output is usually send to pipe or file.


Programming details are available in the file locale/[https://svn.osgeo.org/grass/grass/trunk/locale/README README].
Programming details are available in the file locale/[https://github.com/OSGeo/grass/blob/master/locale/README README].


Important:
Important:
Line 286: Line 248:
[[Category: Documentation]]
[[Category: Documentation]]
[[Category: FAQ]]
[[Category: FAQ]]
[[Category: Translation]]

Latest revision as of 16:31, 9 October 2023

GRASS messages translation project

Many users prefer to use software in their mother tongue which is mostly not English. This requires that all GRASS software messages have to be translated to languages other than English. The GRASS Development Team is seeking translators. Please subscribe to the dedicated mailing list at

    GRASS translations mailing list
    http://lists.osgeo.org/mailman/listinfo/grass-translations

Translation related issues may be discussed there. This is an opportunity for non-programmers to contribute as messages can be easily translated. No programming skills required!

Wanted languages

Simple Chinese, Swahili, Hindi, Greek, Tamil, Russian, Telugu, Português, ... Please join us!

Weblate translation platform

Weblate is a web-based translation tool with tight version control integration. It features a simple and clean user interface, propagation of translations across components, quality checks and automatic linking to source files.

(Note that we migrated from Transifex to Weblate in 2023. All messages on Transifex have been transferred to Weblate.)

How to translate

NOTE: THIS IS FOR TRANSLATOR

Register yourself on the Weblate website using the OSGeo-ID, and start to translate (grasswxpy is the GUI translation and it should be the first translated).

Using the machine translation tool

Using the machine translation tool: We have added the DeepL.com API which helps for selected languages to come to speed with translations.

Usage: login to Weblate. Then you see a button "Automatic suggestion". Use "Clone Translation" to copy over the suggested translation, edit as needed and save it.

Weblate with machine translation DeepL.com API
Weblate with machine translation DeepL.com API

Automated upload of your translation work to the GRASS GIS project in GitHub

Every 24 hours the new translations are automatically pushed to https://github.com/OSGeo/grass/pulls. One of the maintainers will take care to merge them into the code so that it becomes part of the next release.

Files to be edited

GRASS GIS 8 translations

In GRASS GIS 8, we have only 3 types of .po files per language (the files are stored in the source code, in directory locale/po/):


(click to see the GRASS GIS Weblate pages)

  • grasslibs_LANG.po: messages from libraries
  • grassmods_LANG.po: messages from commands ("modules")
  • grasswxpy_LANG.po: messages from wxgrass/wxPython graphical user interface

where "LANG" in the above file names is a two character code which indicates the language. It is based on the Alpha-2 code of ISO 639-1 (right column). Example: grasswxpy_pl.po for Polish.

We highly recommend to use our Weblate server: https://weblate.osgeo.org/projects/grass-gis/!

Weblate: technical background on the installation

How it works: when a developer makes a GRASS GIS repo commit on GitHub, GitHub then calls the webhook on Weblate which triggers a refresh of Weblate's git fork of the GRASS GIS repo (check at ​https://github.com/osgeoweblate/grass/tree/weblate-grass-gis-grasslibs).

For pushing translations back to GitHub, there is a setting in Weblate for that which defaults to 24 hrs (accumulates translations over a day). Then a pull request with the translations will be opened in the GRASS GIS GitHub repo.

For technical background on the OSGeo Weblate installation, see https://wiki.osgeo.org/wiki/SAC:Weblate .

For GRASS GIS related Weblate troubleshooting, see the discussion in this OSGeo-SAC ticket: https://trac.osgeo.org/osgeo/ticket/2981

Weblate Troubleshooting:

In case the Weblate's git copy of the GRASS GIS repo does no longer update due to a conflict or whatever reason:

Log into Weblate (requires administrator rights) and check on <https://weblate.osgeo.org/projects/grass-gis/#repository> click on the "Manage" -> "Repository Maintenance". Therein choose "Update" button, "Update with merge without fast-forward". If successful, this will create another pull request in the GRASS GIS repo (trigger with "Push" button).

Continuing an existing translation

The file(s) are there but partially outdated? Read on.

First announce on the GRASS translations mailing list that you plan to continue the translation of a certain language. Why? Because sometimes people silently translate already and we need these efforts to be coordinated to avoid doing it twice...

Then get these four .po files for your language and start. If a file is missing, just ask on the list to get it generated or see next section. To get these .po files (the files are in the directory locale/po/):

Then edit the files with a .po file editor (poEDIT or kbabel or..., see below). Take care to maintain layout and special characters. And submit often - if you wait for weeks, the messages may already be outdated and your time wasted. Just keep in touch on the GRASS translations mailing list!

Starting a new translation

The language you want isn't yet there? Read on.

Briefly, the steps to create new messages files are (if you find this too complicated, ask on the GRASS translations mailing list to get these files done for you!):

  1. Get the latest source code development version from either the SVN repository or as SVN snapshot (see Download).
  2. run: './configure --with-nls [... other parameters]' to configure the GRASS source code
  3. run: 'cd locale' to change into the translation directory
  4. run: 'make pot' to create grass*.pot template files (to extract original messages)
  5. run: copy these file from templates/ into po/; rename them to contain the two characters language code (see Alpha-2 code of ISO 639-1) and to .po extension; update the file headers either manually or with your .po editing software
 (Example: Polish language):
	        mv ./templates/grasslibs.pot ./po/grasslibs_pl.po
	        mv ./templates/grassmods.pot ./po/grassmods_pl.po
	        mv ./templates/grassnviz.pot ./po/grassnviz_pl.po
	        mv ./templates/grasstcl.pot ./po/grasstcl_pl.po
	        mv ./templates/grasswxpy.pot ./po/grasswxpy_pl.po

Now translate the messages in these po/*.po files (using poEDIT or other editor, see below)

From time to time messages need to be updated from the originals. This is usually done by the GRASS translation manager.

Create a new project

NOTE: CORE DEVELOPERS ONLY!

TODO 2023: improve this section!

A project should be done for each stable release, only an Organization Administrators can create a project. From the dashboard in the left bottom corner there is "New project" button. Fill all the field in the form. More info in Weblate documentation

Once the new project is created you need to upload the resources (the pot file to translate). To create the pot files you can execute

 make pot

inside the locale folder. Now you can load in the Resource section, after you added them you can link the pot file with an online version to get updates. To do this click on "Auto update resources" bottom (read also the Weblate documentation.

At this point you need to load the translated po files, for each language and file you have to upload the translation po file. Some errors could appear, resolution of this problems is a TODO

Get the translated po files

NOTE: THIS IS FOR DEVELOPERS OR POWER USERS

Testing different languages in GRASS GIS

Testing different languages requires that the respective language environment and, if needed, fonts are installed. Check what languages are currently installed on your system with:

 locale -a

To change to a certain language environment (locale), do the following steps (here, example for Unix style environment):

  1. Define/check language settings:
    echo $LANG
    echo $LANGUAGE
    echo $LC_MESSAGES
 
  2. Change it (example for to Japanese):
   a) bash shell:
        export LANG=ja_JP.UTF-8
        export LANGUAGE=ja_JP.UTF-8
        export LC_MESSAGES=ja_JP.UTF-8
 
 
   b) (t)csh shell:
        setenv LANG ja_JP.UTF-8
        setenv LANGUAGE ja_JP.UTF-8
        setenv LC_MESSAGES ja_JP.UTF-8

Now launch GRASS in this terminal. If you launch it from an icon, you have to change the LOCALE in the computer setup program instead.

Other common languages useful for testing are de_DE for German, fr_FR for French, or "C" for none (effectively en_US, which for GRASS is the base language).

Creating startup scripts for different languages

GRASS in English language, save as "grass78eng" (executable flag set, store in path):

     #!/bin/sh
     export LANG=en_US
     export LANGUAGE=en_US
     export LC_MESSAGES=en_US
     exec grass78 "$@"

GRASS in Japanese language, save as "grass78ja" (executable flag set, store in path):

     #!/bin/sh
     export LANG=ja_JA.UTF-8
     export LANGUAGE=ja_JA.UTF-8
     export LC_MESSAGES=ja_JA.UTF-8
     grass78 "$@"

Coordination among translators

If several translators work on the same language files, obviously some coordination is needed. Please announce work via the "translations" mailing list at https://lists.osgeo.org/mailman/listinfo/grass-translations

Also the translation manager is listening there to the upload the changed files into the GRASS source code repository.

Best practices

Installation of language packages

Example: Chinese

  • Debian, Fedora, Ubuntu, ...: the locales should be already present
    • list all valid locales on the system: localectl list-locales
    • show current settings: localectl status
    • set new locale: localectl set-locale LANG=zh_CN.utf8 LC_MESSAGES=zh_CN.utf8

Reduction of similar messages

Please re-use existing messages:

Updating messages in the source code

Generally, to support i18N multiple languages, message strings in GRASS must be modified by adding so-called gettext macros _("...").

C programming language

Change from

 fprintf ( ..., "...\n", ...);

to either

 fprintf ( ..., _("...\n"), ...);

or usually (while omitting \n)

 G_message ( _("..."), ...);

Python programming language

In Python, the macro is used like this:

grass.message(_('Raster map <{name}> unpacked'.format(name=map_name)))

Important hints

Beware:

  • G_message should be used for messages - information about the process for user while fprintf(stdout...) for data output.
  • G_message output is not expected to be send to pipe or file.
  • fprintf(stdout...) output is usually send to pipe or file.

Programming details are available in the file locale/README.

Important:

See also