Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, May 2007
QTranslator problem


Message 1 in thread

Hi,

I'm trying to translate my German default program text into English with
the following code:

public static void main(String[] args)
{
    QApplication.initialize(args);

    QTranslator translator = new QTranslator();
    if (!translator.load("classpath:lang/langfile_en.qm"))
      	System.out.println("File not found!!!");
    QApplication.installTranslator(translator);

    ...
}

I used the tr method for all my user visible strings, generated a ts
file with the command "lupdate *.java langfile_en.ts", translated it
into English with Qt Linguist 4.2.3 and converted the ts file into a qm
file with lrelease.

The load method returns with true so that the error message is not shown
but unfortunately all program texts are still shown in German.


Regards,

Andreas


Message 2 in thread

On Wednesday 30 May 2007 23:14, Andreas Heck wrote:
> Hi,
>
> I'm trying to translate my German default program text into English with
> the following code:
>
> public static void main(String[] args)
> {
>     QApplication.initialize(args);
>
>     QTranslator translator = new QTranslator();
>     if (!translator.load("classpath:lang/langfile_en.qm"))
>       	System.out.println("File not found!!!");
>     QApplication.installTranslator(translator);
>
>     ...
> }
>
> I used the tr method for all my user visible strings, generated a ts
> file with the command "lupdate *.java langfile_en.ts", translated it
> into English with Qt Linguist 4.2.3 and converted the ts file into a qm
> file with lrelease.
>
> The load method returns with true so that the error message is not shown
> but unfortunately all program texts are still shown in German.
>
>
> Regards,
>
> Andreas

Hi,

All you have done looks correct.

Could you check which version of lupdate you are using, it should be the one 
coming with Qt-Jambi.

I also coded up a tiny example that you can look at.

Hope this helps :-)

Best regards
	HÃvard FrÃiland

Attachment:

Attachment: TranslationTest.zip
Description: Zip archive