[Interest] problem with localising qt application

Pritam pritam_ghanghas at infosys.com
Wed Feb 29 09:36:19 CET 2012


Hi

I am trying to make my application localisation aware. I looked at qt 
examples.
They all write user visible text inline with the code.
eg:

label->setText(tr("some long text"));

I dont want to embed user texts in source files because sometimes they 
are very long.
It will be better if I can read all user visible text from a file and 
store them in variables. Rest of the source code uses these variables 
when it needs text.
eg:

label->setText(tr(UserTexts::categoryLabelText));

But tr() doesn't recognise it. From documentation I can't figure out any 
easy way to do that. Unless I check the current language at startup and 
read appropriate version of my file for that language. But in that case 
I don't get any benefit of Qt Linguist.

-- 
Regards,
Pritam


**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are not 
to copy, disclose, or distribute this e-mail or its contents to any other person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
every reasonable precaution to minimize this risk, but is not liable for any damage 
you may sustain as a result of any virus in this e-mail. You should carry out your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120229/474e60a8/attachment.html>


More information about the Interest mailing list