<div dir="ltr">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()<br></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">
<br>Timur<br><br></div></div>
<br><br><div class="gmail_quote">On Mon, Jan 13, 2014 at 1:21 PM, Thomas Tanghus <span dir="ltr"><<a href="mailto:thomas@tanghus.net" target="_blank">thomas@tanghus.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Monday 13 January 2014 12:52 Timur Kristóf wrote:<br>
> Here is how I do it:<br>
><br>
> 1. Check the LANG environment variable<br>
> 2. Check QLocale::system().name()<br>
><br>
> Take a look at the code here:<br>
> <a href="https://github.com/Venemo/puzzle-master/blob/master/helpers/util.cpp#L24" target="_blank">https://github.com/Venemo/puzzle-master/blob/master/helpers/util.cpp#L24</a><br>
<br>
</div>QTranslator::load()[1] already performs all the checks you do, so is there<br>
really a need to do more than this?<br>
<br>
    QTranslator* translator = new QTranslator;<br>
    QString locale = QLocale::system().name();<br>
    if(!translator->load(SailfishApp::pathTo("translations").toLocalFile() + "/" + locale + ".qm")) {<br>
        qDebug() << "Couldn't load translation";<br>
    }<br>
<br>
[1] <a href="http://qt-project.org/doc/qt-5.0/qtcore/qtranslator.html#load" target="_blank">http://qt-project.org/doc/qt-5.0/qtcore/qtranslator.html#load</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Med venlig hilsen / Best Regards<br>
<br>
Thomas Tanghus<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
SailfishOS.org Devel mailing list</div></div></blockquote></div><br></div>