translator stuff - still not working

master
Tibor 1 year ago
parent faa6357fc6
commit 14b785096a
  1. 5
      NNotes_de_DE.ts
  2. 24
      main.cpp
  3. 4
      qml.qrc

@ -10,8 +10,9 @@
</message>
<message>
<location filename="DirectoryDialog.qml" line="20"/>
<source>(e.g. /home/myuser/Nextcloud or C:sersmyuserNextcloud)</source>
<translation>(z.B. /home/myuser/Nextcloud oder C:\\Users\\myuser\\Nextcloud)</translation>
<source>(e.g. /home/myuser/Nextcloud or C:<byte value="x0"/>sersmyuserNextcloud)</source>
<oldsource>(e.g. /home/myuser/Nextcloud or C:\\Users\\myuser\\Nextcloud)</oldsource>
<translation type="unfinished">(z.B. /home/myuser/Nextcloud oder C:\\Users\\myuser\\Nextcloud)</translation>
</message>
</context>
<context>

@ -41,10 +41,26 @@ int main(int argc, char *argv[])
QApplication app { argc, argv };
app.setWindowIcon(QIcon("qrc:/appicon.ico"));
// app.setWindowIcon(QIcon("qrc:/res/appicon.ico"));
QApplication::setStyle("Windows");
// Translator
QTranslator translator;
const QStringList uiLanguages { QLocale::system().uiLanguages() };
for (const QString& locale : uiLanguages) {
QString baseName { "NNotes_" + QLocale(locale).name() };
if (translator.load(":/i18n/" + baseName)) {
app.installTranslator(&translator);
break;
}
}
// QML engine
QQmlApplicationEngine engine;
const QUrl url { QStringLiteral("qrc:/main.qml") };
@ -54,12 +70,6 @@ int main(int argc, char *argv[])
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
// TODO Translator is not working yet
QTranslator translator;
if (translator.load(QLocale(), QLatin1String("NNotes"), QLatin1String("_"), QLatin1String(":/i18n"))) {
QCoreApplication::installTranslator(&translator);
}
// Configuration parsing
std::vector<QString> configVars {

@ -3,6 +3,8 @@
<file>main.qml</file>
<file>NoteTreeView.qml</file>
<file>DirectoryDialog.qml</file>
<file>appicon.ico</file>
<file>res/add.png</file>
<file>res/appicon.ico</file>
<file>res/notes.png</file>
</qresource>
</RCC>

Loading…
Cancel
Save