[Qt-interest] QTranslator / QThread
Arnold Krille
arnold at arnoldarts.de
Wed May 27 12:18:17 CEST 2009
Hi,
On Wednesday 27 May 2009 09:30:44 GZimmermann at t-systems.com wrote:
> I've a problem concerning using translators in threads.
> The program I've written makes extensive use of threads for background
> processing. The threads send status messages to the main thread via the
> standard signal / slot mechanisms. So far so good. The thing is, I can't
> get the program to actually apply the translations I've provided (via
> app.installTranslator). Only strings in the main thread are translated,
> never those generated in the worker threads. So: translation basically does
> work, but not for threads (as was to be expected, I'm sure). I couldn't
> find any hints in the documentation; I've tried to load a translator within
> the background threads and then using translator.translate() instead of
> tr(), but this resulted in an empty string, probably because I was to dumb
> to set the context correctly. Is there any method that should work, even
> for dumb people like me?
Not tested:
- Maybe use the message strings without tr() in the secondary threads, but
make them translated by NOOP_TR(...). Or if using tr() doesn't result in
errors but just in untranslated strings in secondary threads, just stay with
it.
- Push the messages from the secondary threads through tr(...) again in the
main thread.
Probably this disabled any usage of context/information in the translation,
but I don't really know.
Have fun,
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090527/52ea8fdf/attachment.bin
More information about the Qt-interest-old
mailing list