Talk:Pootle

From SME Server
Jump to navigation Jump to search

Preliminary

The Goal is to manage SME translations with Pootle hosted on contribs.org. The current method excellent as it is makes it hard to find missing strings and to easily replace them.

Once we have everything worked out how to interact with pootle and the formmagick stuff then I'll get something up on contribs.org that everyone can use. It would be really nice if we could automate the extraction/import of files that need to be translated into pootle but first things first.

Slords 18:23, 24 January 2008 (MST)

Pootle Usage

Test pootle site: http://www.unixlan.com.ar:8888

untranslated words

click "Show Editing Functions" and finally at "Quick Translate" for each file or whole language.

Also you can see the suggestions clicking at "Review Suggestions".

checks

click "show checks" to see a list of syntax errors

acronyms  6 strings (2%) failed
brackets 17 strings (6%) failed
doublequoting 4 strings (1%) failed
doublespacing 1 string (0%) failed
endpunc 11 strings (3%) failed
endwhitespace 4 strings (1%) failed
numbers 2 strings (0%) failed
puncspacing 2 strings (0%) failed
sentencecount 2 strings (0%) failed
simplecaps 16 strings (5%) failed
startcaps 6 strings (2%) failed
unchanged 7 strings (2%) failed
untranslated 53 strings (19%) failed

click on one of the links offered and fix them

See http://translate.sourceforge.net/wiki/guide/pofilter_examples and http://translate.sourceforge.net/wiki/guide/translation/commonerrors

Merging new strings

Add, remove or modify strings in the template/*.pot file then click 'update from template'.

New strings are added
modified strings use existing data and made fuzzy (i think)
deleted strings are moved to the bottom of the file and commented out with #~

Formagick

we are using http://linux.die.net/man/1/xml2po to convert the xml lexicons to .po files and back

I have packaged for a better installation. You can download from

http://mirror.contribs.org/smeserver/contribs/nhall/sme7/contribs/pootle/rpm/gnome-doc-utils-0.12.0-1.noarch.rpm

Before try, you must edit a few lines. [ we now use /usr/share/xml2po/smetrans.py ]

/usr/share/xml2po/empty.py

Line 27 from "return ['base', 'A', 'a', 'i', 'I', 'B', 'b' ,'P' ,'p' ,'h2' ,'H2', 'div', 'DIV', 'font']
Line 31 from "return []" to "return ['trans']"
Line 35 leave "return []"
Line 39 from "return []" to "return ['trans']" // or ['lang'] testing

Create .po and export xml files

we have written a few shell scripts, which are automating checking, we'll release later for contribs authors

bugs

  • newxml needs to set: lang="fr"
sed script or look at
xml2po -l fr -p yum.po yum > yum.xml
-l --language=LANG Set language of the translation to LANG
  • you can't have a <base> equal to a <trans>

http://bugs.contribs.org/show_bug.cgi?id=3863

Console

update all .po files

Templates have been implemented with up to date strings,
now it's over to users to translate them


.po file names are inconsistent, SV & FR add .tmpl.po

.tmpl.po is correct, other languages have been updated


Use UTF-8 for console .po files

Pootle has problems with the current charset=iso-8859-1
we now use UTF-8

revision control using CVS/SVN

Today I had a quick look at the pootle pages and found a wiki as well, which has some valuable information like for instance revision control using CVS/SVN: http://translate.sourceforge.net/wiki/pootle/version_control - Cactus 03:26, 25 January 2008 (MST)

progress

we'll look at this later, perhaps starting with contribs

A few links for future implementation:
http://subversion.tigris.org/tools_contrib.html#po_update_sh
http://subversion.tigris.org/tools_contrib.html#verify_po_py
http://subversion.tigris.org/tools_contrib.html#svnmerge_py
http://subversion.tigris.org/tools_contrib.html#svnmerge_sh

Remarks

Translation Workflow

Draft suggestions ...

The original files are in cvs.

.po files

  • gettext strings are in various files in cvs, currently we think we have them all in pootle as .pot template files
we need to use xgettext to search a maintained list of files to extract current gettext strings
this may find missing, or modified strings or remove old strings saving on pointless translations
  • existing translations have been placed in pootle and merged with the templates
this shows missing translations very nicely and is ready for user testing
  • all .po files have been converted to UTF-8, they can be converted back easily if necessary
  • changes to original files, ie changed gettext strings, have to be tracked as usual in the bug tracker
these are imported into the templates, other languages are updated with a click
  • at some point we diff against cvs po files, the patch is checked and applied.

FormMagick files

  • these are XML files with a <base> and <trans> pair of strings, these can be converted to .po files with some work
  • some rough scripts are being worked on above, there may be others on the net waiting to be found...
we need to clean up some inconsistencies in the english lexicons and they will be our .pot templates
we need to script the conversion of existing translations into .po files, discussed above
  • changes to original files, have to be tracked as usual in the bug tracker
the following is speculative ...
these are imported into the .pot templates, other languages are updated with a click
I think any new <base> strings have to be added to the cvs xml file for each language
  • at some point we run xml2po to apply the new translation back to the xml file,
then diff against cvs, make patch, check and apply

Pootle issues

UTF-8

Bug created, 'Use UTF-8 for console .po files' http://bugs.contribs.org/show_bug.cgi?id=3858

SME Translation files currently use iso-8859-1
we currently convert any file in pootle to UTF-8
we can convert back when returning to SME if necessary, by adding one line in a script.

Testing Pootle I have found a few issues. I will try to describe.

Pootle (and Translation Toolkit used by Pootle) use as default a charset UTF-8. Everytime I have create a new language translation, Pootle parse from templates encoding as UTF-8. Everytime I have "Update from templates" the target PO files are updated as UTF-8, and if target has set charset=iso-8859-1, it is then corrupted. I can't found a method to set Pootle to use ISO-8859-1 as default. Because this, and to avoid these issues I have decide to use UTF-8 as charset in Pootle. Please see http://translate.sourceforge.net/wiki/guide/locales/glibc?s=charset#editing

Not only Pootle. Every desktop translation tool set UTF-8 as default charset.

If you want to merged or override a PO file, convert to UTF-8 (if not yet). Then you can upload without corrupt the target file.

One note for admins when Pootle run at contribs.org: I suggest to use a tool for convert from UTF-8 to ISO-8859-1 before make a new language rpm update package (if gettext can't support utf-8 encoding).

I have use this great script to convert between any charset files in a directory:

#!/bin/bash

#./dir_iconv.sh dir cp1251 utf8 - converts all files from directory dir .. cp1251 (windows-1251) to utf8.

ICONVBIN='/usr/local/bin/iconv' # path to iconv binary

if [ $# -lt 3 ]
then
    echo "$0 dir from_charset to_charset"
    exit
fi

for f in $1/*
do
    if test -f $f
    then
        echo -e "\nConverting $f"
        /bin/mv $f $f.old
        $ICONVBIN -f $2 -t $3 $f.old > $f
    else
        echo -e "\nSkipping $f - not a regular file";
    fi
done

This apply also to panels (if formmagick can't support UTF-8 encoding)

There is an open posibility to modify Pootle or translation toolkit to make this automatically, but I don't know how to do. --Normando Hall 12:45, 2 February 2008 (MST)

  1. . Formmagick supports UTF-8: http://search.cpan.org/~mitel/CGI-FormMagick-0.89/lib/CGI/FormMagick.pm
  2. . GetText does support UTF-8 as well: http://www.gnu.org/software/gettext/manual/gettext.html#Charset-conversion
It is quite common for translations/lexicons to be in UTF8 as this is a well known locale independent character set, probably also the reason why Pootle is sticking to UTF-8. - Cactus 15:01, 2 February 2008 (MST)