.xrc file and i18n with poedit

Hello,

I made a little python script to use wxrc and xgettext within poedit. Here
is the script, named xrcgettext.py:

#!/usr/bin/env python2.2

import sys
import os

wxrcArgs = ""
wxrcArgsFlag = False
xgettextArgs = ""
for arg in sys.argv[1:]:
    if (arg != ":"):
        if not wxrcArgsFlag:
            wxrcArgs += arg + " "
        else:
            xgettextArgs += arg + " "
    else:
       wxrcArgsFlag = True

os.system("wxrc -g -o /tmp/dummy "+wxrcArgs)
os.system("xgettext -C "+xgettextArgs+" /tmp/dummy")

To use it from poedit, you need to add a Parsers entry like this:

Language XRC
Extensions *.xrc
Command xrcgettext.py %F : %K -o %o
Keywords -k%k
Files %f

The script is not very clean, not very smart, and does not handle with
errors. Feel free to improve it ;o) One could use the optik module to get
the options and make the complete command line.

Hope it will be usefull...

···

--
   Frederic

   http://linux.gbiloba.org