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

Reply via email to