source: ogBrowser-Git/src/main.cpp @ 816ccac

jenkinsmain
Last change on this file since 816ccac was 0b68674, checked in by Vadim Troshchinskiy Shmelev <vtroshchinskiy@…>, 18 months ago

Buscar traducciones en multiples rutas

  • Property mode set to 100644
File size: 1010 bytes
Line 
1#include <QApplication>
2#include <QTranslator>
3#include <QDebug>
4
5#include "mainwindow.h"
6
7int main(int argc, char *argv[])
8{
9    QApplication a(argc, argv);
10    QCoreApplication::setApplicationName("OGBrowser");
11    QCoreApplication::setOrganizationName("OpenGnsys");
12    QCoreApplication::setOrganizationDomain("opengnsys.es");
13
14    QTranslator translator;
15    QStringList translationDirs{QCoreApplication::applicationDirPath(), "", "."};
16
17    bool translationsOk = false;
18
19    for(const QString &dir : translationDirs) {
20        qDebug() << "Trying to find translations in" << dir;
21        if (translator.load(QLocale(), "OGBrowser_", "", dir)) {
22            qDebug() << "Translations loaded";
23            QCoreApplication::installTranslator(&translator);
24            translationsOk = true;
25            break;
26        }
27    }
28
29    if (!translationsOk) {
30        qWarning() << "Failed to load translations. Tried looking in:" << translationDirs;
31    }
32
33    MainWindow w;
34    w.show();
35    return a.exec();
36}
Note: See TracBrowser for help on using the repository browser.