[Interest] problem with localising qt application
Konstantin Tokarev
annulen at yandex.ru
Wed Feb 29 09:40:42 CET 2012
29.02.2012, 12:36, "Pritam" <pritam_ghanghas at infosys.com>:
> 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));
Try
label->setText(tr("UserTexts::categoryLabelText"));
instead. Of course, you are free in choice of string identifiers because they have nothing to do with C++.
--
Regards,
Konstantin
More information about the Interest
mailing list