Difference between revisions of "Language Administration"
(Extend abstract) |
(Append former Translation#Project Maintainers) |
||
Line 129: | Line 129: | ||
::# verify, the po content is recent, else [[#Program|msgmerge]] a fresh pot. | ::# verify, the po content is recent, else [[#Program|msgmerge]] a fresh pot. | ||
::# in [https://hosted.weblate.org/settings/gnucash/gnucash/#files weblate:GnuCash/Program/Einstellungen] remove it from the filter. | ::# in [https://hosted.weblate.org/settings/gnucash/gnucash/#files weblate:GnuCash/Program/Einstellungen] remove it from the filter. | ||
+ | |||
+ | =When to msgmerge= | ||
+ | Some translators complain, it is so hard to update .po files. When should we do it? | ||
+ | ;From https://translationproject.org/html/robot.html: The Translation Project robot is not allowed to update the registry with new information about maintainers, languages, or translators, nor is it allowed to process POT files. These things are still handled by hand. ''When a new POT file is being registered by a project coordinator, the registering script calls <tt>msgmerge</tt>'' when previous translations exist, so translators are notified of a PO file which is up-to-date. New POT files are announced automatically to a team's mailing list, if the team has asked for this feature. | ||
+ | So for $TP_LINGUAS it is done on each release - at least for the updated files. | ||
+ | :OTOH Weblate has a different philosophy: it should be done just in time. | ||
+ | :As TP ignores our po[t] files, it can be done often. | ||
+ | |||
+ | =Merging with divergent source trees like 2.6 to 2.7= | ||
+ | The source tree in GnuCash 2.7 was thoroughly restructured, so it is now very different from 2.6. One side effect of this is that the MsgIds in our 2.7 *.po files are in a completely different order compared to 2.6. This means <code>git merge</code> of maint in unstable will break the 2.7 *.po files. So when merging from 2.6 to 2.7 we have to ignore all changes in the maint po files at this point. | ||
+ | To rescue at least parts of the work, try this. | ||
+ | <syntaxhighlight lang="sh"> | ||
+ | # Set your language in LL, e.g.: export LL=de | ||
+ | # while you are in the maint branch save your .po file outside of the repo e.g. as maint."$LL".po | ||
+ | git checkout unstable | ||
+ | git merge maint # resolve the full LL.po merge by using the unstable version of LL.po (other files can be merged as normal) | ||
+ | cd ../build # assuming ../build is your build directory | ||
+ | make pot # update the template with changes from maint | ||
+ | cd ../src/po # assuming src is your gnucash git repo | ||
+ | msgmerge "$LL".po ../build/po/gnucash.pot -o "$LL".po # update the po of your $LL | ||
+ | msgcat --use-first "$LL".po ../<path_to>/maint."$LL".po -o "$LL".new.po | ||
+ | </syntaxhighlight> | ||
+ | For the best result you might test different msgcat parameters. Finally | ||
+ | <syntaxhighlight lang="sh">mv "$LL".new.po "$LL".po</syntaxhighlight> |
Revision as of 06:05, 18 March 2021
This page lists often used commands, sorted by components. In general there are 3 tasks, all done by admins in the repositories of the components:
- Updating translations (MsgStr) sent by translators over different channels;
- and, both requiring a fresh pot file,
- Add a new language on request of a potential translator
- Merging new messages (MsgId) from the source files.
Before this content was spread over several places in Translation.
Contents
Intro
- About Checks
-
- gettext has a basic set of checks, they should be run before each 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. Run it from time to time to verify that the headers are still state of the art.
As we get translations from several resources, we run basic checks before committing! Fix them or report them to the LAST TRANSLATOR, if possible.
- Wrapping
- Some editors — like Geany / PoHelper 1.36 — do not wrap the messages. To have them easier comparable, the wrapping can be done with:
msgcat -o po/${LL}.po po/${LL}.po
- Source String Changes
- 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.
- After a msgmerge
- Before we used weblate it was recommened to send a short mail to gnucash-devel about "Translators: <Component> changed ..." with some clues, what changed like
- "complete new download page" or
- "fixed 42 typos in the english text".
- 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.
- TP specific
-
- download from TP's latest gnucash files,
- checks as usual.
- on commit set the file's Last-Translator as author.
- 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
As it is asmall project, it uses a simple Makefile. Also check and statistics are integrated in the mo generation, which again is required to be committed each time a po file changes.
- 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
- 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
- makefile
- to languages
- 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
-
- Ask the Last Translator, cc the language coordinator
- If there is no response after a week
-
- Ask Benno to mark the language as external. The result can be seen in Translation Project: The gnucash textual domain;
- in po/CMakeLists.txt move it from TP_LINGUAS to GC_LINGUAS
- verify, the po content is recent, else msgmerge a fresh pot.
- in weblate:GnuCash/Program/Einstellungen remove it from the filter.
When to msgmerge
Some translators complain, it is so hard to update .po files. When should we do it?
- From https://translationproject.org/html/robot.html
- The Translation Project robot is not allowed to update the registry with new information about maintainers, languages, or translators, nor is it allowed to process POT files. These things are still handled by hand. When a new POT file is being registered by a project coordinator, the registering script calls msgmerge when previous translations exist, so translators are notified of a PO file which is up-to-date. New POT files are announced automatically to a team's mailing list, if the team has asked for this feature.
So for $TP_LINGUAS it is done on each release - at least for the updated files.
- OTOH Weblate has a different philosophy: it should be done just in time.
- As TP ignores our po[t] files, it can be done often.
Merging with divergent source trees like 2.6 to 2.7
The source tree in GnuCash 2.7 was thoroughly restructured, so it is now very different from 2.6. One side effect of this is that the MsgIds in our 2.7 *.po files are in a completely different order compared to 2.6. This means git merge
of maint in unstable will break the 2.7 *.po files. So when merging from 2.6 to 2.7 we have to ignore all changes in the maint po files at this point.
To rescue at least parts of the work, try this.
# Set your language in LL, e.g.: export LL=de
# while you are in the maint branch save your .po file outside of the repo e.g. as maint."$LL".po
git checkout unstable
git merge maint # resolve the full LL.po merge by using the unstable version of LL.po (other files can be merged as normal)
cd ../build # assuming ../build is your build directory
make pot # update the template with changes from maint
cd ../src/po # assuming src is your gnucash git repo
msgmerge "$LL".po ../build/po/gnucash.pot -o "$LL".po # update the po of your $LL
msgcat --use-first "$LL".po ../<path_to>/maint."$LL".po -o "$LL".new.po
For the best result you might test different msgcat parameters. Finally
mv "$LL".new.po "$LL".po