[SailfishDevel] How to translate (lupdate) ?

Timur Kristóf timur.kristof at gmail.com
Mon Jan 13 15:28:20 UTC 2014


Not sure what you mean by "already performs all the checks you do" - it
doesn't check LANG, nor does it check QLocale::system().name()


Timur



On Mon, Jan 13, 2014 at 1:21 PM, Thomas Tanghus <thomas at tanghus.net> wrote:

> On Monday 13 January 2014 12:52 Timur Kristóf wrote:
> > Here is how I do it:
> >
> > 1. Check the LANG environment variable
> > 2. Check QLocale::system().name()
> >
> > Take a look at the code here:
> > https://github.com/Venemo/puzzle-master/blob/master/helpers/util.cpp#L24
>
> QTranslator::load()[1] already performs all the checks you do, so is there
> really a need to do more than this?
>
>     QTranslator* translator = new QTranslator;
>     QString locale = QLocale::system().name();
>     if(!translator->load(SailfishApp::pathTo("translations").toLocalFile()
> + "/" + locale + ".qm")) {
>         qDebug() << "Couldn't load translation";
>     }
>
> [1] http://qt-project.org/doc/qt-5.0/qtcore/qtranslator.html#load
>
> --
> Med venlig hilsen / Best Regards
>
> Thomas Tanghus
> _______________________________________________
> SailfishOS.org Devel mailing list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140113/d75a1cf7/attachment.html>


More information about the Devel mailing list