[Interest] question about translations and QT_NO_CAST_FROM_ASCII

franki franki at franki.eu.org
Wed Jan 30 16:27:24 CET 2013


Hi all,

I'm trying to add internationalization to my app, and I found that this:
DEFINES += QT_NO_CAST_FROM_ASCII
can be added to .pro file to ensure that no string is omitted from tr function.

However, I'm using XML's inside my app, to communicate with server, and these 
xml's should not be translated, I mean I have code like this:

QDomDocument Helper::createBasicXml(QString type,QString moduleName) {
    QDomDocument xml;
    QDomElement update=xml.createElement(type);
    xml.appendChild(update);
    QDomElement module=xml.createElement("module");
    module.setAttribute("name",moduleName);
    update.appendChild(module);
    return xml;
}
And there are also setProperty calls and many others that should not be 
translated.

is there some trick to have this QT_NO_CAST_FROM_ASCII in .pro file and also 
some strings like "module" "name" not being translated by Qt ?

I have found:
#undef QT_NO_CAST_FROM_ASCII
#define QT_NO_CAST_FROM_ASCII
but it appears that this does not work in my code, I mean there are still 
errors that:
QString::QString(const char*)' is private
between undef and define

best regards
Marek



More information about the Interest mailing list