[Localization] Display a phrase without translation

Любомир Василев lyubomirv at abv.bg
Sat Feb 3 11:05:44 CET 2018


Hi, Pavel

I do not know if Qt directly supports such a thing (someone else could 
comment), but I believe you can write a simple function for that. 
Something like:

void logAndGUI(const std::string& text)
{
     TO_LOG << text;
     TO_GUI << tr(text);
}

If you need arguments, that would require a bit more code but it is doable.

Good luck,

Lyubomir Vasilev


На 3.02.2018 в 11:48, Карелин Павел написа:
> Hi,
>
> I ran into an unexpected problem: I need to output a phrase to the log 
> file and be displayed in messages for the user. In the log file, the 
> phrase should be without translation, but in the message for the user 
> with the translation.
> Is it possible to do this using only one instance of the phrase? Or do 
> I have to duplicate the phrase?
> For example:
>   TO_LOG << "Hello world"
>   TO_GUI  << tr("Hello world")   // Duplication
>
>
> --
> BR, Pavel Karelin
>
>
>
> _______________________________________________
> Localization mailing list
> Localization at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/localization

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/localization/attachments/20180203/830bc181/attachment.html>


More information about the Localization mailing list