Gettext PO file support for xbmc (reworked2) #917

merged 3 commits into from May 4, 2012


None yet
3 participants

alanwww1 commented May 1, 2012

This is a rework of PR 868 and 910 using standard string functions instead of direct character manipulation and using const refs wherever possible.
It serves as a first stage for gettext support in xbmc and having a better web based translation system.

I managed to keep the speed at least 2-3 times fast than the TinyXML parser.
I tested speed with adding these debug lines:


The results:

English PO: core: 2.3ms, confl.: 0.37ms
English XML: core: 10.54ms, confl.: 0.85ms

German PO: core: 4.5ms, confl.: 0.51ms
German XML: core: 13.22ms, confl.: 1.21ms

I also tested if things are ok, with writing out memeory dump files from the filled memory with the original XML file and with the new PO file. The test was done with the same debug commit from my test branch:


You can see the dump files here:


For the English strings, the dump files are binary identical. Also all the other language files are only differ in spots where the original English xml file contained a deleted or blanked entry where the translated language file had a valid entry. These entries does not get into the PO file.

So I think it is safe to say that the parser is working great.

I also updated the xbmc-xml2po utility I've written to version 0.9.
Added ability to convert all strings to utf8 in the PO files. It was tricky for the Win side because of libiconv, but I solved it.

Windows binary was also updated.

I also added ability to break long lines in gettext rules to look nice and organized. I also extended this capability to not only recognize \n as Line Feed, but also [CR] which we have for skin strings. So the files are looking great. Also the plural form for the specific language gets written into the PO file.

Of course we still have strings.xml as a fallback in case no strings.po file exists in the language directory.

Also (for a short transitional period) I kept the strings.xml files for even where the converted srtings.po files already exist.
The purpose for this is to handle pre written PR-s. I will manually add the new strings coming to the strings.xml files to the new strings.po files.

The new PO files are directly suitable for use with web based translation tools eg., what I will intend to use for all translations.

Also please check this post about the format:


jmarshallnz commented May 2, 2012

Nice work - just some small stuff to fix.


Montellese commented May 2, 2012

You do know that you don't need to create a new PR everytime you change something? You can just (force) push to the same branch and github will automatically update the PR.


ghost commented May 2, 2012

yes. please listen to montellese ;)


alanwww1 commented May 2, 2012

Thank you guys for all the help ! I'll be a lot wiser next time.
Now I've done a force push with the new and rebased code.

Hope everything is ok now.
Let me know,
Cheers !


jmarshallnz commented May 2, 2012

Nice work on the rebase. To give you a bit of practice I spotted another couple nasties and a few typos. :)

alanwww1 was assigned May 3, 2012


jmarshallnz commented May 3, 2012

Looks good - pull the trigger :)


alanwww1 commented May 3, 2012

Thanks :-)
I make a final check on WIndows (if all the last corrections compile OK)
Also I make a new thread about the new format for all Devs to know how to use it etc.
Thank you for the help again !

@alanwww1 alanwww1 added a commit that referenced this pull request May 4, 2012

@alanwww1 alanwww1 Merge pull request #917 from alanwww1/PO-support-reworked-PR2
[gettext] implemented numeric ID based Gettext PO file support

@alanwww1 alanwww1 merged commit 51af60f into xbmc:master May 4, 2012

@tru tru added a commit to plexinc/plex-home-theater-public that referenced this pull request Dec 11, 2013

@tru tru Implement skipTo for pictures
Fixes #917
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment