translation basics

master
Tibor 1 year ago
parent 20c7db0436
commit c8d88d9563
  1. 5
      .gitignore
  2. 2
      DirectoryDialog.qml
  3. 54
      NNotes_de_DE.ts
  4. 18
      main.cpp
  5. 6
      main.qml

5
.gitignore vendored

@ -89,3 +89,8 @@ compile_commands.json
*.app
build_*
/release
/debug
/*.log
/nnotes.cfg
/.vs

@ -17,7 +17,7 @@ Dialog {
id: textField
width: parent.width
placeholderText: "(e.g. /home/myuser/Nextcloud or C:\\Users\\myuser\\Nextcloud)"
placeholderText: qsTr("(e.g. /home/myuser/Nextcloud or C:\\Users\\myuser\\Nextcloud)")
onTextChanged: {
dirPath = text

@ -1,3 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE"></TS>
<TS version="2.1" language="de_DE">
<context>
<name>DirectoryDialog</name>
<message>
<location filename="DirectoryDialog.qml" line="5"/>
<source>Change your Nextcloud directory here</source>
<translation>Ändere hier den Pfad zu deinem Nextcloud-Ordner</translation>
</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>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="main.qml" line="9"/>
<source>NNotes 0.1</source>
<translation>NNotes 0.1</translation>
</message>
<message>
<location filename="main.qml" line="36"/>
<source>File</source>
<translation>Datei</translation>
</message>
<message>
<location filename="main.qml" line="38"/>
<source>Save</source>
<translation>Speichern</translation>
</message>
<message>
<location filename="main.qml" line="49"/>
<source>&amp;Change Nextcloud folder...</source>
<translation type="unfinished">&amp;Nextcloud-Ordner ändern...</translation>
</message>
<message>
<location filename="main.qml" line="244"/>
<source>Saved.</source>
<translation>Gespeichert.</translation>
</message>
<message>
<location filename="main.qml" line="248"/>
<source>Failed.</source>
<translation>Fehlgeschlagen.</translation>
</message>
<message>
<location filename="main.qml" line="57"/>
<source>&amp;Close</source>
<translation>Schließen</translation>
</message>
</context>
</TS>

@ -8,6 +8,8 @@
#include <QMessageBox>
#include <QIcon>
#include <QTranslator>
// STL includes
#include <cstdio>
@ -15,6 +17,8 @@
#include "config.h"
#include "notehandler.h"
#define QSTR(x) QObject::tr(x)
int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@ -50,6 +54,12 @@ 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 {
@ -79,8 +89,8 @@ int main(int argc, char *argv[])
if (notesFolder.isEmpty()) {
QMessageBox box {
QMessageBox::Warning,
"Nextcloud configuration not found",
"Your Nextcloud configuration file couldn't be found. Trying to read path from nnotes.cfg..."
QSTR("Nextcloud configuration not found"),
QSTR("Your Nextcloud configuration file couldn't be found. Trying to read path from nnotes.cfg...")
};
box.setModal(true);
box.exec();
@ -90,8 +100,8 @@ int main(int argc, char *argv[])
if (notesFolder.isEmpty()) {
QMessageBox box {
QMessageBox::Warning,
"Path not provided",
"The path to your Nextcloud folder hasn't been configured yet in your nnotes.cfg file. Please set it using File -> Open."
QSTR("Path not provided"),
QSTR("The path to your Nextcloud folder hasn't been configured yet in your nnotes.cfg file. Please set it using File -> Change Nextcloud folder.")
};
box.setModal(true);
box.exec();

@ -33,7 +33,7 @@ ApplicationWindow {
menuBar: MenuBar {
Menu {
title: "File"
title: qsTr("File")
Action {
text: qsTr("Save")
onTriggered: {
@ -241,11 +241,11 @@ ApplicationWindow {
if (noteHandler) {
if (noteHandler.saveContent(treeView.currentIndex, text)) {
// fancy animation!
savedText.text = "Saved."
savedText.text = qsTr("Saved.")
nebgrAnimSaved.start();
}
else {
savedText.text = "Failed."
savedText.text = qsTr("Failed.")
nebgrAnimError.start()
}
}

Loading…
Cancel
Save