update_po has now been changed to automatically scan the py files, so developers no longer need to add .py files somewhere to be scanned.

What is needed:

1/ files that should not be scanned: add them to POTFILES.skip

2/ files that the scan does not pick up and should be used: add them to

Please check nothing is missing.


2012/10/3 Benny Malengier <>

2012/10/3 Benny Malengier <>
One more thing.
I don't like the name gramps for the list of files. Can we use again?
We can remove POTFILES.skip I suppose and that gramps file then.

I changed my mind. I would like to have it automatic, and only blacklist things. I'll quickly try that.


It sufficies there to svn skip empty lines or lines starting with #, which is the case in
latest rev 20502.

So if you could move back to with the nice in directories divided structure?
Guideline would then again be: for code that must be translated: update


2012/10/3 Benny Malengier <>

I don't follow everything you wrote :-)

I updated, now files are present in gramps.pot also. Please test.
So that is fixed. All works for python 2.7 now. Optionparser is deprecated, but not difficult to change to the new system, we can do that another time.

About documentation, I meant something in the lines of how to use update_po to be up to date for translation or release. The help only explains the options.

I don't see the problems in tips, you will have to be more specific if there is something I should look at.

The warnings you mention (I suppose you mean the output "../gramps/plugins/view/ warning: 'msgid' format string with unnamed arguments cannot be properly localized:"
are things in the translation you can fix

I also fixed a bit for pt_BR output on check, not sure if that is the problem you meant.

Lastly, "5. What should be done with:
/data/gramps.xml, /data/gramps.desktop, /data/gramps.keys?"
I don't follow, is there a problem there? intltool-extract is used for these, will this stop working?


2012/10/3 jerome <>
> "I removed make and friends now."

Oh, so fast!

Note, 'update_po' is a mix between 'get_strings' (Gramps 2.0) logic, the way used by Gnome (intltool, POTFILES), Stephen George (Windows port) and Kees Bakker's (check_po)!

Currently, only few translators have generated the template for translations via make. On trunk, we just need to check if something is not wrong or missing for a complete 'gramps.pot'.

The others flags are just set of commands often used by translators.

> "1/add some documentation at top of update_po on how it should be used. To me it is not clear at the moment :-)"

python po/ -h
python po/ --help

You are right maybe because I generated and tested this file, I was aware of existing flags ... :(

> "2/update the translation documentation on the wiki, so we have an old page which is for gramps 3.x and before, and a current page on how to do things with gramps 4."

Yes, I will do. :)

> "update_po seems to run here with python2.7"

Maybe when a function is 'deprecated', there is a transition period?
ie. still work with 2.7, but will be removed soon?

The problem could occur when we try to retrieve strings from with python 2.7 and the iteration function: a naming issue (and generator) between python 2.6 and python 2.7 ... :(

Note, about the output, there is some minor issues:

1. has some special cases (not consistent by parsing).
During testing it was tips 7 and 18!

EOL or something like that, because the quick parser for getting these strings need special cases:

  tip = tip.replace("\n</_tip>\n", "</_tip>\n") # special case tip 7
  tip = tip.replace("\n<b>", "<b>") # special case tip 18

2. some translation strings might be improved according python mapping!
Just run 'update_po -p' for generating a new template and you will see some warnings. It was planned to improve current code.

The classical _('%s is %s with %s for %s under %s at %s')

What are these variables/values???
How to order them???

3. check flag ("-k", "--check") will not properly work for locale with more than two characters (pt_BR, zh_CN)...

4. generated 'gramps.pot' will ignore strings from ''.
A reference issue, which is set under 'gramps' file (plain text file).

5. What should be done with:
/data/gramps.xml, /data/gramps.desktop, /data/gramps.keys?
I guess they were unchanged since many years, but currently they are always parsed (gramps.pot) and regenerated every time during build time (under Linux, BSD, etc ...MacOS?)!

All cosmetic issues.


--- En date de : Mer 3.10.12, Benny Malengier <> a écrit :

De: Benny Malengier <>
Objet: Re: Re : po
À: "jerome" <>
Cc: "Gramps Development List" <>
Date: Mercredi 3 octobre 2012, 11h34


I removed make and friends now.
update_po seems to run here with python2.7.

If you need help with something, just let me know.
It would be great if you:

1/add some documentation at top of update_po on how it should be used. To me it is not clear at the moment :-)

2/update the translation documentation on the wiki, so we have an old page which is for gramps 3.x and before, and a current page on how to do things with gramps 4.9

2012/10/2 jerome <>


It is still experimental for handling po files and gramps.pot with python libs and GNU tools only.

In fact, it was tested with python 2.6 some months ago...

One thing is remaining for a complete support with python 2.7: one "function/set of lines" is still working with python 2.6 only.

Something like:

from xml.etree import ElementTree

    tree = ElementTree.parse(filename)

    root = tree.getroot()

    mark = _tip

    for key in root.getiterator(mark):

I tested an other way, which seems to be more correct, something like:

    for key in root.iter():

        if key.attrib.get(mark):


To spare one line does not really makes sense if this does not work after a python update/migration... I suppose it could be one common function for both files who really need to be parsed: 'holidays.xml' and 'tips.xml'.

Note, 'optparse' is also a deprecated module under python 2.7 (migration)...

I know that it should rather use 'argparse' with this python version.

> Second, if you test on python version, don't check on the 7, but use instead > or <.

Currently, it should still work with python 2.6 and there is a partial support with python 2.7. About python 3.x, I do not think this will work!

Yes, the next step will be to support python 2.7 and +.

If so, do not need to test for python 2.6 anymore.

Note, about translation and 'src->gramps' migration, one module usage is not clear, but I guess it will be modified on next revisions: ''. It is cosmetic. ie. to change '' reference by ''. Else, 'update_po' has grouped all commands/steps for translation/template handling by using python.

John and Rob did not think that getting rid of 'intltool' was useful.

If Gramps provides a more 'python-standard' way for installation, I suppose to have a python script for translations might be also useful.

It could be also used under others pateforms with few efforts.

Thank you for advices about coding.


--- En date de : Lun 1.10.12, Benny Malengier <> a écrit :

De: Benny Malengier <>

Objet: po

À: "Jérôme" <>

Cc: "Gramps Development List" <>

Date: Lundi 1 octobre 2012, 19h30


I see you changed update_po. Some things.

First, trunk requires python 2.7, so it is not needed to do python 2.6 workarounds.

Second, if you test on python version, don't check on the 7, but use instead > or <.