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 <tho...@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
>
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to