Difference between revisions of "Language Administration"

From GnuCash
Jump to: navigation, search
(Program: fix a copy error)
Line 68: Line 68:
  
 
===Website===
 
===Website===
 +
It uses a simple makefile.
 +
;Check: <Syntaxhighlight lang="sh">
 +
# 1 file:
 +
make $LOCALE
 +
# OR all files:
 +
make mos
 +
</syntaxhighlight>
 +
:;Important: Commit the updated mo files to make the changes visible!
 +
 +
;Update: after messages in source files changed <Syntaxhighlight lang="sh">
 +
# 1. make po/gnucash-htdocs.pot:
 +
make pot
 +
# 2. update po files:
 +
make msgmerge
 +
</syntaxhighlight>
 +
:feel free to send a short mail to gnucash-devel about "Translators: Website changed ..."
 +
: give them some clues, what changed like
 +
:: "complete new download page" or
 +
:: "fixed 42 typos in the english text".
 +
;Create a new po file: <Syntaxhighlight lang="sh">
 +
# 1. make pot:
 +
make pot
 +
# 2. add a new po file:
 +
cd po/
 +
msginit --no-translator -l $LOCALE
 +
cd ..
 +
# DON'T FORGET: add it to Makefile
 +
</syntaxhighlight>
 +
;Integrate a new translation: into
 +
:#;makefile: to <tt>languages</tt>
 +
:# If a language is new or was ''bitrotten'', add or enable in
 +
:#;externals/header.phtml: a line in <syntaxhighlight lang="html" inline ><span id="language"></syntaxhighlight> and
 +
:#;lang.php: a line in <syntaxhighlight lang="php">
 +
# key: locale, value: lang_dir
 +
$supported_languages = array(
 +
        'ca_ES' => 'ca',
 +
        :
 +
        'C' => 'en'
 +
        );
 +
</syntaxhighlight>
 +
:#;Note: A few languages are disabled here, because they are '''bitrotten'''.
  
 
== Moving a Language Between Translation Projects ==
 
== Moving a Language Between Translation Projects ==

Revision as of 05:30, 12 February 2021

This page lists often used commands, sorted by components. Collected from several places in Translation.

Intro

About Checks
  • gettext has a basic set of checks, they should be run before committing.
  • translation-toolkit, used by weblate, has a very powerfull set, but it still needs configuration. There are still cases, were our sources are of low quality and should be fixed before. The only check, which User:Fell didn'T find is msgfmt's --check-accelerators.
  • There are other checks, which can be useful like i18nspector for the structure of po[t] files.

As we get translations from several resources, we run basic checks before committing! Fix them or report them to the LAST TRANSLATOR, if possible.

In theory each time a programmer changes a user visible message, a new pot file should be created and merged into all po files. Sometimes new po files are requested.

Notes on command components
LANG=C
serves to get the messages in english to forward them to the translator.
$LOCALE
replace it by the desired locale.
$BUILDDIR
replace it with the right path.

Components

Glossary

The glossary defines the terminology used in all components.

Check
# 1 file:
msgfmt -c --statistics po/glossary/$LOCALE.po
# OR all files:
for i in po/glossary/*.po; do echo -n "$i:"; LANG=C msgfmt -c --statistics $i ; done
Update
# 1. make pot:
po/glossary/txt-to-pot.sh po/glossary/gnc-glossary.txt > po/glossary/gnc-glossary.pot
# 2. update glossaries:
for i in po/glossary/*.po; do echo -n "$i:"; LANG=C msgmerge --previous -U $i po/glossary/gnc-glossary.pot ; done
New language
cd po/glossary/
# 1. make pot:
./txt-to-pot.sh gnc-glossary.txt > gnc-glossary.pot
# 2. add a new glossary:
msginit --no-translator -l $LOCALE
# DON'T FORGET: add it to CMakeLists.txt
cd ../..

Program

Assumption
Usage of ninja. If you are using make replace ninja by make.
Check
# 1 file:
LANG=C msgfmt -c --check-accelerators="_" --statistics po/$LOCALE.po
# OR all files:
for i in po/*.po; do echo -n "$i:"; LANG=C msgfmt -c --check-accelerators="_" --statistics $i ; done
Errors caused by --check-accelerators="_"
should be reported to the translator only,
Other errors
should be fixed. At least set the fuzzy flag to inform the translator.
Update
# 1. make pot:
ninja pot
# 2. update po files:
for i in po/*.po; do echo -n "$i:"; LANG=C msgmerge --previous -U $i $BUILDDIR/po/gnucash.pot ; done
New language
# 1. make pot: (tut's das?)
$BUILDDIR/ninja pot
# 2. create a new po file:
cd po/
msginit --no-translator -i $BUILDDIR/po/gnucash.pot -l $LOCALE
# DON'T FORGET: add it to CMakeLists.txt
cd ..

Website

It uses a simple makefile.

Check
# 1 file:
make $LOCALE
# OR all files:
make mos
Important
Commit the updated mo files to make the changes visible!
Update
after messages in source files changed
# 1. make po/gnucash-htdocs.pot:
make pot
# 2. update po files:
make msgmerge
feel free to send a short mail to gnucash-devel about "Translators: Website changed ..."
give them some clues, what changed like
"complete new download page" or
"fixed 42 typos in the english text".
Create a new po file
# 1. make pot:
make pot
# 2. add a new po file:
cd po/
msginit --no-translator -l $LOCALE
cd ..
# DON'T FORGET: add it to Makefile
Integrate a new translation
into
  1. makefile
    to languages
  2. If a language is new or was bitrotten, add or enable in
    externals/header.phtml
    a line in <span id="language"> and
    lang.php
    a line in
    # key: locale, value: lang_dir
    $supported_languages = array(
            'ca_ES' => 'ca',
            :
            'C' => 'en'
            );
    
    Note
    A few languages are disabled here, because they are bitrotten.

Moving a Language Between Translation Projects

From TP to weblate
  1. Ask the Last Translator, cc the language coordinator
If there is no response after a week
  1. Ask Benno to mark the language as external. The result can be seen in Translation Project: The gnucash textual domain;
  2. in po/CMakeLists.txt move it from TP_LINGUAS to GC_LINGUAS
  3. verify, the po content is recent, else msgmerge a fresh pot.
  4. in weblate:GnuCash/Program/Einstellungen remove it from the filter.