[Qtscript-bindings] Making scripts translatable

Girish Ramakrishnan girish at forwardbias.in
Thu Aug 28 04:26:29 CEST 2008


Kent Hansen wrote:
> I have a solution 
> finished up already, but before I describe it I'd like to ask if anyone 
> has an opinion on how it should be done (in a perfect world), if there 
> are any "issues" you foresee, or anything else you can think of. Any 
> input is greatly appreciated.
> 

I haven't spent a lot of time thinking about this, but here goes.

1. It should behave just like Qt's i18n system. IOW, it should look into
.qm files, translators should be able to use linguist and all that. tr
should be able to get the strings out the script in put it in .qs.

2. Scripts are (to me) like plugins. Which means, plugin writers might
want to provide their own translation file for their script. Hence, we
need a QTranslator per script. If not, we fallback to application's
translator. QTranslator for the script should be settable in C++ and script.

3. We need context for script strings. So, a mechanism to set the
default context for strings in script and C++ and for lupdate. Also,
provide a translate() for non-default context. Maybe, we can have some
fancy way of detecting context from function names but I fear this might
lead to conflicts with c++ context (in the case, where we run lupdate on
a project that has embedded scripts).

Girish


More information about the Qtscript-bindings mailing list