[Qt-interest] How translate constants
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Mon Dec 14 17:15:02 CET 2009
Andre Somers wrote on Monday, December 14, 2009 11:25 AM:
>> ... But how can I translate my constants which are
>> initialized before loading translator?
>>
> Isn't the point of a constant that it is... eh... constant?
Yes - and no. For example you want the following "constant" string to be immutable:
const char *CONSTANT_ENGLISH_STRING = "Things will never change (unless Pi does)!";
But off course you still want it to be displayed in a different language, so you need to translate the original string (which remains still unchanged, off course!). And you mark such strings with the beforementioned Q_TR_NOOP (within a given class "context") or QT_TRANSLATE_NOOP (where you can explicitly specify the "context").
Note that translation itself does /not/ change the original string ;)
See e.g. http://doc.trolltech.com/4.6/qtglobal.html#QT_TRANSLATE_NOOP
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list