File: Qt5TranslationLoader.cpp.in

package info (click to toggle)
qps 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 2,632 kB
  • sloc: cpp: 13,198; makefile: 8
file content (33 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* This file has been generated by the CMake qt_translation_loader().
 * It loads Qt application translations.
 *
 * Attention: All changes will be overwritten!!!
 */

#include <QCoreApplication>
#include <QLocale>
#include <QTranslator>
#include <QLibraryInfo>

static void loadQtTranslation()
{
    QString locale = QLocale::system().name();
    QTranslator *qtTranslator = new QTranslator(qApp);

    if (qtTranslator->load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
        qApp->installTranslator(qtTranslator);
    } else {
        delete qtTranslator;
    }

    QTranslator *appTranslator = new QTranslator(qApp);
    if (appTranslator->load(QString("@translations_dir@/@catalog_name@_%1.qm").arg(locale))) {
        QCoreApplication::installTranslator(appTranslator);
    } else if (locale == QLatin1String("C") ||
                locale.startsWith(QLatin1String("en"))) {
        // English is the default. It's translated anyway.
        delete appTranslator;
    }
}

Q_COREAPP_STARTUP_FUNCTION(loadQtTranslation)