Bugs: Browse | Submit New | Admin

[#12636] Qt::Application#installTranslator doesn't work

Date:
2007-07-27 15:18
Priority:
3
Submitted By:
Benjamin Kay (kc8tbe)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Qt::Application#installTranslator doesn't work

Detailed description
Using C++ it is possible to mark strings in your source for translation with QObject::tr(), create translations for
those strings, and then apply the translations with QApplication.installTranslator() at runtime. See this brief tutorial
at trolltech.com: http://doc.trolltech.com/4.3/linguist-hellotr.html

I don't know if this is a bug or a feature request, but it would be nice to have the same functionality in Ruby. I've
attached three files, hello.rb, hello.pro, and japanese.ts. Here's how to replicate the bug:

1. Download hello.rb and hello.pro to the same folder.
2. Generate a ts file with:
$ lupdate -verbose hello.pro
3. Edit the ts file in Linguist, or by hand. "Hello World" in Japanese is 今日は世界
4. Or, if you don't feel comfortable editing japanese.ts, use the version I provide by placing it in the same folder
as hello.rb and hello.pro.
5. Generate a qm file with File > Release in Linguist or with:
$ lrelease japanese.ts
6. Run hello.rb
$ ruby hello.rb
The script ought to display "Hello World" in Japanese, that is 今日は世界, but instead it simply displays
"Hello World" in English. To hypothetically get the script to display in English instead of Japanese, edit
hello.rb or delete/rename japanese.qm.

The bug seems to be at line 10 of the script.
app.installTranslator(translator)
Returns nil.

This was done on Ubuntu Feisty Fawn with libqt4-ruby1.8_1.4.9-4_amd64, which should be equivalent to qt4-qtruby 1.4.9.

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
hello.tar.gz files to replicate the bug Download

Changes:

Field Old Value Date By
File Added2295: hello.tar.gz2007-07-27 15:18kc8tbe