[Qtscript-bindings] Making scripts translatable

Girish Ramakrishnan girish at forwardbias.in
Thu Aug 28 14:57:31 CEST 2008


Kent Hansen wrote:
> Girish Ramakrishnan wrote:
>> 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.
>>   
> 
> Why settable in script? (Well, if you have imported the Qt bindings you 
> can do it of course... :-) )

I was thinking something on the lines of: Lets say I write
myextension.js and ship along with it a myextension.qm, how is the host
program to know where the translations reside? The problem with using
QTranslator using Qt bindings is that it changes the application's tr()
lookup. And that's just asking for trouble if the context conflicts. So,
I was asking for a tr() in script that will lookup only its own
translation file and then maybe the application as fallback (so it won't
look up the translation files of other scripts).

That said, I don't think its necessary. I think we have the same problem
with Qt plugins anyway (afaik) and I haven't ever seen people complain
anything about this :-).

As for the context, using filename as default and providing a
setContext() sounds flexible enough to me.

Girish


More information about the Qtscript-bindings mailing list