i am having a hard time to get automatic translations for strings in an
xrc file.
In my application the locales are installed, the translations files are
in place. I can use a typical pattern like
someText = _('player_label')
in my application without problem. The translations machinery works
fine. However when i try to use an XmlResource things are going
haywire.
I tried loading the xrc file as follows
xrc.XmlResource(path,flags=xrc.XRC_USE_LOCALE)
In my xrc file a typical enty would besomething like this
<label>_('label_help')</label>
which doesn't work.
Is there anything special i have to do in the xrc file with my strings?
I found only little documentation which hinted me using a I18nString
attribute however so far i didn't manage to get that work either.
In my xrc file a typical enty would besomething like this
<label>_('label_help')</label>
which doesn't work.
Is there anything special i have to do in the xrc file with my strings?
Yes, but don't do it with the _() in the xrc file, just use the regular label string in the xrc. Then use the wxrc (or pywxrc) utility with the -g flag to parse the xrc and extract the labels and write them with the _() added on. You can then run the output of that through xgettext to put the labels in your po file for translations. When the xrc is loaded then all labels and etc. are run through wxGetTranslation(), and so if there is an entry in your message catalog for it, (and that catalog domain has been loaded with wx.Locale) then the translation should be used automatically.
ยทยทยท
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!