Edit detail for Internationalisation i18n revision 1 of 1

1
Editor: cinepaint
Time: 2006/10/26 04:34:36 GMT+0
Note: page reworked, Hartmut Sbosny

changed:
-
Internationalisation for CinePaint

    The FilmGimp version of CinePaint uses Gnu Gettext and the Gtk1 toolkit.<br>
    This feature has been introduced since version 0.21-0.

    Worth reading short introductions exist on the www:<br>
    http://en.wikipedia.org/wiki/Gettext

    Translation activities are coordinated on the cinepaint-devel mailing list:<br>
    http://lists.sourceforge.net/lists/listinfo/cinepaint-developers


Users

    Set your environment variable <tt>LANG</tt> to your language like:<br>
      <tt># export LANG=de_DE</tt><br>
    Start CinePaint. It should show translated strings in the user interface so far
    a translation has been provided.


Translators

    Existing languages can be translated by editing the <i>language.po</i> files in the 
    three po*/ directories<pre>
    po/
    po-plug-ins/
    po-script-fu/ </pre>

   **Textdomains:**<br>
    CinePaint uses currently<br>
      the 'cinepaint' textdomain in the <i>po/</i> directory and<br>
      the 'cinepaint-std-plugins' textdomain translated in the <i>po-plug-ins/</i>
        directory;<br>
      the 'cinepaint-script-fu' textdomain in the <i>po-script-fu/</i> directory is
        included in case someone activates script-fu.

   **New Languages:**<br>
    To add a new language copy (in each po*/ directory) the template file <i>cinepaint-xxx.pot</i> 
    to <i>new_language.po</i> (like <i>de.po</i>, <i>fr.po</i>, ...). The new language gets
    detected by doing a <tt>configure</tt> in the toplevel directory. Make sure that
    <i>new_language.po</i> files exist in all three po*/ directories.

   **Translation:**<br>
    A virgin <i>.po</i> file consists of pairs<pre>
    msgid "english_text"
    msgstr ""</pre>
    Replace the empty ("") msgstr string by your translation of the english text.

    Take care about the 'fuzzy' keyword. It is a sign that gettext has found by some internal
    rules a vague translation which needs a human review. Correct the translation if necessary
    and remove the 'fuzzy' keyword. Only then the translation will be used.

   **Activate Changes:**<br>
    After editing a <i>.po</i> file do a<br> 
      <tt># make</tt><br>
    (either in the po*/ directory itself or in the toplevel directory) and the human readable 
    <i>.po</i> file gets compiled into a binary <i>.gmo</i> file ready for installation.
    After a<br>
      <tt># make install</tt><br>
    the new translated strings should apear in CinePaint so far
    your environment variable <tt>LANG</tt> was set to your language.

   **Workflow:**<br>
    A full `<tt>make install</tt>' takes some time and is overweighted if only a changed
    <i>.po</i> file is to reinstall. Since during a translation session this task may
    be needed more frequently, a reduction to the essential might be of interest.
    The following sample script updates for the 'cinepaint-std-plugins' textdomain
    (directory <i>po-plug-in/</i>) the  <i>.gmo</i> binary files and installs
    (copies) the german <i>de.gmo</i> file on its right place in the install 
    directory.<pre>
#!/bin/sh
# 1) Updates (recreates) for the `cinepaint-std-plugins' textdomain the `.gmo' 
#  binary files from the human readable `.po' files by calling `make' in
#  the ${SOURCEROOT}/po-plug-ins/ source directory.
#
# 2) Installs the `de.gmo' binary file by copying into the directory 
#  ${PREFIX}/share/locale/LC_MESSAGES/de/ as `cinepaint-std-plugins.mo'
#  file, where ${PREFIX} is CinePaint's install directory as given in 
#  `configure --prefix=...' (default: PREFIX=/usr/local). 

# Adapt this for your directories:
SOURCEROOT=~/Programme/cinepaint/cinepaint-0.21-1
PREFIX=/usr/local

# Adapt this for your language ("de" -> ...)
cd ${SOURCEROOT}/po-plug-ins/
make
cp de.gmo ${PREFIX}/share/locale/de/LC_MESSAGES/cinepaint-std-plugins.mo

# END OF SCRIPT</pre>


Programmers

   **Core Files:**<br>
    In core files include the file "libgimp/gimpintl.h".

   **Plug-in Files:**<br>
    In plug-in files include "libgimp/stdplugins-intl.h".<br>
    Put the statement<pre>
    INIT_I18N_UI(); </pre>
    somewhere before your first translateable string is used, possibly in run().

   **Marking of Strings:**<br>
    The above include files provide the <tt>_()</tt> macro. Put strings, 
    which shall be translated, in the <tt>_()</tt> macro.
    This macro will be substituded by <tt>gettext()</tt>, or by <tt>()</tt> if i18n
    support is disabled. Example:: 

    void f (const char* fname) {
      const char* str_abbort = _("Abbort");
      printf (_("Could not open file '%s'!\n"), fname); 
      puts (str_abbort);
    }

   The strings "Abbort" and "Could not open file &#39%s&#39!\n" would appear
    then in the *.po* files. 
    <!-- Negative indent to end the `::' mode! -->

   **File Registration:**<br>
    Registrate source files, which contain marked strings, in <tt>po*/POTFILES.in</tt>.
    Only files registered there will be searched in the following step for translateable
    strings.
    <!--Remove <tt>po*/POTFILES</tt>, it will be recreated next time <tt>configure</tt>
    is called.  - Seems not necessary. Hartmut -->

   **Activate Changes:**<br>
    After adding or changing of marked strings, a search run is neseccary to transfer
    these strings into the associated <i>.pot</i> and <i>.po</i> files.
    To upgrade the <i>cinepaint-xxx.pot</i> file and all <i>.po</i> files in one of 
    the po*/ directories, change into this directory, remove the <i>cinepaint-xxx.pot</i>
    file and type<br>
      <tt># make update-po</tt><br>
    This recreates <i>cinepaint-xxx.pot</i> and updates all <i>.po</i> files. 
    To only recreate <i>cinepaint-xxx.pot</i> do a<br>
      <tt># make cinepaint-xxx.pot</tt>

    Now the translation work can be done by editing the <i>.po</i> files as described
    in the Translators section above.

   **Plug-ins:**<br>
    Plug-ins have their own text domain, see above.
    Be carefully with menupaths. Despite the string "<Image>/File/Print/..." would
    appear in the appropriate <i>.po</i> file, it would not be translated by CinePaint.
    CinePaint splits menupaths by the '/' separator. To translate the above menupath 
    put the menupath atoms as dummy strings like <tt>_("Print");</tt> somewhere in your
    source code. (The string "File" should already be marked as translateable in the 
    plug-ins textdomain.)<br>
    Test that not two menupaths exist like "<Image>/Filters/Fancy/My Filter" and
    "<Image>/Filters/Krass/Mein Filter".


   **External translations:**<br>
    After using external translations, you can change back the textdomain by<pre>
    textdomain("cinepaint-std-plugins");</pre>


Languages

    A list of available languages and their status:

<dl>
<dt>catalan</dt>    <dd>ca_ES ; ?% ; ??</dd>
<dt>czech</dt>      <dd>cs_CZ ; ?% ; ??</dd>
<dt>danish</dt>     <dd>da_DK; ?% ; ??</dd>
<dt>dutch</dt>      <dd>nl_NL; 75% ; Hassan Khoshkhabar</dd>
<dt>greek</dt>      <dd>el_GR; ?% ; ??</dd>
<dt>spanish</dt>    <dd>es_ES; ?% ; ??</dd>
<dt>finnish</dt>    <dd>fi_FI; ?% ; ??</dd>
<dt>french</dt>     <dd>fr_FR; 99% ; Pascal LACROIX</dd>
<dt>irish</dt>      <dd>ga_IE ; ?% ; ??</dd>
<dt>galish</dt>     <dd>gl_ES; ?% ; ??</dd>
<dt>german</dt>     <dd>de_DE ; 98% ; Kai-Uwe Behrmann</dd>
<dt>croatian</dt>   <dd>hr_HR ; ?% ; ??</dd>
<dt>hungarian</dt>  <dd>hu_HU ; ?% ; ??</dd>
<dt>italian</dt>    <dd>it_IT ; ?% ; ??</dd>
<dt>japanese?</dt>  <dd>ja_JP ; ?% ; ??</dd>
<dt>korean?</dt>    <dd>ko_KR ; ?% ; ??</dd>
<dt>lithuanian</dt> <dd>lt_LT ; ?% ; ??</dd>
<dt>norwegian</dt>  <dd>nn_NO ; ?% ; ??</dd>
<dt>norwegian</dt>  <dd>no_NO ; ?% ; ??</dd>
<dt>polish</dt>     <dd>pl_PL ; ?% ; ??</dd>
<dt>portugese brazil</dt>  <dd>pt_BR ; ?? ; ?%</dd>
<dt>portugese</dt>  <dd>pt_PT ; ?% ; ??</dd>
<dt>romanian</dt>   <dd>ro_RO ; ?% ; ??</dd>
<dt>russian</dt>    <dd>ru_RU ; ?% ; ??</dd>
<dt>slovak</dt>     <dd>sk_SK ; ?% ; ??</dd>
<dt>slovenian</dt>  <dd>sl_SI ; ?% ; ??</dd>
<dt>swedish</dt>    <dd>sv_SE ; ?% ; ??</dd>
<dt>turkish</dt>    <dd>tr_TR ; ?% ; ??</dd>
<dt>ukrainian?</dt> <dd>uk_UA ; ?% ; ??</dd>
<dt>chinese? </dt>  <dd>zh_CN ; ?% ; ??</dd>
<dt>chinese?</dt>   <dd>zh_TW ; ?% ; ??</dd>
</dl>

initially written on 8. april 2006, by Kai-Uwe Behrmann <ku dot b at gmx dot de

updated on 17. July 2006, by Kai-Uwe Behrmann<br>
updated on 26. April 2006, by Kai-Uwe Behrmann<br>
reworked on 22. October 2006, by Hartmut Sbosny <hartmut dot sbosny at gmx dot de>

back to [CinePaintDocumentation]

Internationalisation for CinePaint

The FilmGimp version of CinePaint uses Gnu Gettext and the Gtk1 toolkit.
This feature has been introduced since version 0.21-0.

Worth reading short introductions exist on the www:
http://en.wikipedia.org/wiki/Gettext

Translation activities are coordinated on the cinepaint-devel mailing list:
http://lists.sourceforge.net/lists/listinfo/cinepaint-developers

Users

Set your environment variable LANG to your language like:
# export LANG=de_DE
Start CinePaint. It should show translated strings in the user interface so far a translation has been provided.

Translators

Existing languages can be translated by editing the language.po files in the three po*/ directories

    po/
    po-plug-ins/
    po-script-fu/ 

Textdomains:
CinePaint uses currently
the cinepaint textdomain in the po/ directory and
the cinepaint-std-plugins textdomain translated in the po-plug-ins/ directory;
the cinepaint-script-fu textdomain in the po-script-fu/ directory is included in case someone activates script-fu.

New Languages:
To add a new language copy (in each po*/ directory) the template file cinepaint-xxx.pot to new_language.po (like de.po, fr.po, ...). The new language gets detected by doing a configure in the toplevel directory. Make sure that new_language.po files exist in all three po*/ directories.

Translation:
A virgin .po file consists of pairs

    msgid "english_text"
    msgstr ""
Replace the empty ("") msgstr string by your translation of the english text.

Take care about the fuzzy keyword. It is a sign that gettext has found by some internal rules a vague translation which needs a human review. Correct the translation if necessary and remove the fuzzy keyword. Only then the translation will be used.

Activate Changes:
After editing a .po file do a
# make
(either in the po*/ directory itself or in the toplevel directory) and the human readable .po file gets compiled into a binary .gmo file ready for installation. After a
# make install
the new translated strings should apear in CinePaint so far your environment variable LANG was set to your language.

Workflow:
A full `make install' takes some time and is overweighted if only a changed .po file is to reinstall. Since during a translation session this task may be needed more frequently, a reduction to the essential might be of interest. The following sample script updates for the cinepaint-std-plugins textdomain (directory po-plug-in/) the .gmo binary files and installs (copies) the german de.gmo file on its right place in the install directory.

#!/bin/sh
# 1) Updates (recreates) for the `cinepaint-std-plugins' textdomain the `.gmo' 
#  binary files from the human readable `.po' files by calling `make' in
#  the ${SOURCEROOT}/po-plug-ins/ source directory.
#
# 2) Installs the `de.gmo' binary file by copying into the directory 
#  ${PREFIX}/share/locale/LC_MESSAGES/de/ as `cinepaint-std-plugins.mo'
#  file, where ${PREFIX} is CinePaint's install directory as given in 
#  `configure --prefix=...' (default: PREFIX=/usr/local). 

# Adapt this for your directories: SOURCEROOT=~/Programme/cinepaint/cinepaint-0.21-1 PREFIX=/usr/local

# Adapt this for your language ("de" -> ...) cd ${SOURCEROOT}/po-plug-ins/ make cp de.gmo ${PREFIX}/share/locale/de/LC_MESSAGES/cinepaint-std-plugins.mo

# END OF SCRIPT

Programmers

Core Files:
In core files include the file "libgimp/gimpintl.h".

Plug-in Files:
In plug-in files include "libgimp/stdplugins-intl.h".
Put the statement

    INIT_I18N_UI(); 
somewhere before your first translateable string is used, possibly in run().

Marking of Strings:
The above include files provide the _() macro. Put strings, which shall be translated, in the _() macro. This macro will be substituded by gettext(), or by () if i18n support is disabled. Example:

    void f (const char* fname) {
      const char* str_abbort = _("Abbort");
      printf (_("Could not open file '%s'!\n"), fname); 
      puts (str_abbort);
    }

The strings "Abbort" and "Could not open file '%s'!\n" would appear then in the .po files.

File Registration:
Registrate source files, which contain marked strings, in po*/POTFILES.in. Only files registered there will be searched in the following step for translateable strings.

Activate Changes:
After adding or changing of marked strings, a search run is neseccary to transfer these strings into the associated .pot and .po files. To upgrade the cinepaint-xxx.pot file and all .po files in one of the po*/ directories, change into this directory, remove the cinepaint-xxx.pot file and type
# make update-po
This recreates cinepaint-xxx.pot and updates all .po files. To only recreate cinepaint-xxx.pot do a
# make cinepaint-xxx.pot

Now the translation work can be done by editing the .po files as described in the Translators section above.

Plug-ins:
Plug-ins have their own text domain, see above. Be carefully with menupaths. Despite the string "/File/Print/..." would appear in the appropriate .po file, it would not be translated by CinePaint. CinePaint splits menupaths by the / separator. To translate the above menupath put the menupath atoms as dummy strings like _("Print"); somewhere in your source code. (The string "File" should already be marked as translateable in the plug-ins textdomain.)
Test that not two menupaths exist like "/Filters/Fancy/My Filter" and "/Filters/Krass/Mein Filter".

External translations:
After using external translations, you can change back the textdomain by

    textdomain("cinepaint-std-plugins");

Languages

A list of available languages and their status:

catalan
ca_ES ; ?% ; ??
czech
cs_CZ ; ?% ; ??
danish
da_DK; ?% ; ??
dutch
nl_NL; 75% ; Hassan Khoshkhabar
greek
el_GR; ?% ; ??
spanish
es_ES; ?% ; ??
finnish
fi_FI; ?% ; ??
french
fr_FR; 99% ; Pascal LACROIX
irish
ga_IE ; ?% ; ??
galish
gl_ES; ?% ; ??
german
de_DE ; 98% ; Kai-Uwe Behrmann
croatian
hr_HR ; ?% ; ??
hungarian
hu_HU ; ?% ; ??
italian
it_IT ; ?% ; ??
japanese?
ja_JP ; ?% ; ??
korean?
ko_KR ; ?% ; ??
lithuanian
lt_LT ; ?% ; ??
norwegian
nn_NO ; ?% ; ??
norwegian
no_NO ; ?% ; ??
polish
pl_PL ; ?% ; ??
portugese brazil
pt_BR ; ?? ; ?%
portugese
pt_PT ; ?% ; ??
romanian
ro_RO ; ?% ; ??
russian
ru_RU ; ?% ; ??
slovak
sk_SK ; ?% ; ??
slovenian
sl_SI ; ?% ; ??
swedish
sv_SE ; ?% ; ??
turkish
tr_TR ; ?% ; ??
ukrainian?
uk_UA ; ?% ; ??
chinese?
zh_CN ; ?% ; ??
chinese?
zh_TW ; ?% ; ??

initially written on 8. april 2006, by Kai-Uwe Behrmann

updated on 17. July 2006, by Kai-Uwe Behrmann
updated on 26. April 2006, by Kai-Uwe Behrmann
reworked on 22. October 2006, by Hartmut Sbosny

back to CinePaintDocumentation