[Interest] question about translations and QT_NO_CAST_FROM_ASCII

Иван Комиссаров abbapoh at gmail.com
Wed Jan 30 16:31:34 CET 2013


In qt4, this construction was used:

xml.createElement(QLatin1String("module"));

I'm not sure about qt5.

Иван Комиссаров

30.01.2013, в 19:27, franki <franki at franki.eu.org> написал(а):

> 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
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 



More information about the Interest mailing list