[GCompris-devel] Bug in the translation system

Karl Ove Hufthammer karl at huftis.org
Sun Jan 11 10:50:53 UTC 2015


Hi!

I’ve found a bug in the GCompris translation system. It looks like fuzzy
translations in the .po files are being treated as finished translations
(leading a very confusing UI).

I’m not very familiar with the cmake build system, but AFAICS, the
translated .po files are being convert with (basically) this command 

  lconvert -if po -of qm -i gcompris_xx.po -o gcompris_xx.qm

The correct way would be to generate .ts files instead, and then use
‘lrelease’ with the ‘-nounfinished’ option:

  lconvert -if po -of ts -i gcompris_xx.po -o gcompris_xx.ts
  lrelease -compress -nounfinished gcompris_xx.ts

However, there is still one problem. ‘lconvert’ doesn’t seem to handle
obsolete messages in .po files correctly. For example, my .po file
contained these lines at the end:

#~| msgctxt "ActivityInfo|"
#~| msgid "Train your memory and remove all the cards"
#~ msgctxt "ActivityInfo|"
#~ msgid "Train your audio memory and remove all the violinists Tux."
#~ msgstr "Øv deg på å hugsa lydar, og fjern alle Tux-fiolinistane."

Running lconvert on the file gave these error messages
(and no .qm or .ts file generated):

PO-format parse error in line 4284: '#~| msgctxt "ActivityInfo|"'
PO-format parse error in line 4285: '#~| msgid "Train your memory and remove all the cards"'

However, the file is perfectly valid, as confirmed with ‘msgfmt
--check’. So for the conversion to (always) work one needs to remove the
obsolete strings from the .po file first, e.g. by using

  msgattrib --no-obsolete gcompris_xx.po -o gcompris_cleaned_xx.po

To sum up, to generate correct .qm files, one needs to run ‘msgattrib’
followed by ‘lconvert’ followed by ‘lrelease’. I guess one could avoid
using lrelease by adding ‘--no-fuzzy’ too to msgattrib, but ‘lconvert’
doesn’t have a ‘-compress’ option. I’m not sure how important that is,
though. In my test, adding ‘-compress’ actually created a slightly
*larger* .qm file.

-- 
Karl Ove Hufthammer
http://huftis.org/
Jabber: karl at huftis.org



More information about the GCompris-devel mailing list