Add i18n support with German translation

All user-visible strings wrapped with i18n(). German .po file
provided. Translation domain set to "kdenote".
This commit is contained in:
Levi Neely 2026-07-12 20:52:18 +02:00
parent 1a34435ed8
commit 39e37cf602
4 changed files with 84 additions and 20 deletions

View File

@ -14,8 +14,10 @@ include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMSetupVersion)
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(KF6 REQUIRED COMPONENTS FileMetaData)
find_package(KF6 REQUIRED COMPONENTS FileMetaData I18n)
add_subdirectory(lib)
add_subdirectory(extractor)
add_subdirectory(fileitemaction)
ki18n_install(po)

View File

@ -1,5 +1,7 @@
find_package(KF6 REQUIRED COMPONENTS KIO WidgetsAddons)
add_definitions(-DTRANSLATION_DOMAIN="kdenote")
add_library(kdenote_fileitemaction MODULE
denote_fileitemaction.cpp
)
@ -8,6 +10,7 @@ target_link_libraries(kdenote_fileitemaction
kdenote_lib
KF6::KIOWidgets
KF6::WidgetsAddons
KF6::I18n
Qt6::Core
Qt6::Widgets
)

View File

@ -4,6 +4,7 @@
#include "denote_metadata.h"
#include <KFileItem>
#include <KLocalizedString>
#include <KPluginFactory>
#include <QAction>
@ -37,7 +38,7 @@ QList<QAction *> DenoteFileItemAction::actions(const KFileItemListProperties &fi
// Directory: show "New Denote File..."
if (item.isDir()) {
auto *action = new QAction(QStringLiteral("New Denote File..."), parentWidget);
auto *action = new QAction(i18n("New Denote File..."), parentWidget);
action->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
const QString dirPath = item.localPath();
@ -52,7 +53,7 @@ QList<QAction *> DenoteFileItemAction::actions(const KFileItemListProperties &fi
if (meta.isValid())
return {};
auto *action = new QAction(QStringLiteral("Rename with Denote..."), parentWidget);
auto *action = new QAction(i18n("Rename with Denote..."), parentWidget);
action->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
const KFileItemList items = fileItemInfos.items();
@ -93,7 +94,7 @@ void DenoteFileItemAction::renameWithDenote(const KFileItemList &items, QWidget
// Build dialog
QDialog dialog(parentWidget);
dialog.setWindowTitle(QStringLiteral("Rename with Denote"));
dialog.setWindowTitle(i18n("Rename with Denote"));
// Size to 33% of screen width (accounts for HiDPI)
if (auto *screen = dialog.screen()) {
dialog.setMinimumWidth(screen->availableGeometry().width() / 3);
@ -103,15 +104,15 @@ void DenoteFileItemAction::renameWithDenote(const KFileItemList &items, QWidget
auto *form = new QFormLayout();
auto *titleEdit = new QLineEdit(defaultTitle);
form->addRow(QStringLiteral("Title:"), titleEdit);
form->addRow(i18n("Title:"), titleEdit);
auto *tagsEdit = new QLineEdit();
tagsEdit->setPlaceholderText(QStringLiteral("tag1, tag2, tag3"));
form->addRow(QStringLiteral("Tags:"), tagsEdit);
tagsEdit->setPlaceholderText(i18n("tag1, tag2, tag3"));
form->addRow(i18n("Tags:"), tagsEdit);
auto *sigEdit = new QLineEdit();
sigEdit->setPlaceholderText(QStringLiteral("(optional)"));
form->addRow(QStringLiteral("Signature:"), sigEdit);
sigEdit->setPlaceholderText(i18n("(optional)"));
form->addRow(i18n("Signature:"), sigEdit);
layout->addLayout(form);
@ -172,7 +173,7 @@ void DenoteFileItemAction::renameWithDenote(const KFileItemList &items, QWidget
void DenoteFileItemAction::createDenoteFile(const QString &dirPath, QWidget *parentWidget)
{
QDialog dialog(parentWidget);
dialog.setWindowTitle(QStringLiteral("New Denote File"));
dialog.setWindowTitle(i18n("New Denote File"));
if (auto *screen = dialog.screen()) {
dialog.setMinimumWidth(screen->availableGeometry().width() / 3);
}
@ -181,22 +182,22 @@ void DenoteFileItemAction::createDenoteFile(const QString &dirPath, QWidget *par
auto *form = new QFormLayout();
auto *titleEdit = new QLineEdit();
titleEdit->setPlaceholderText(QStringLiteral("Note title"));
form->addRow(QStringLiteral("Title:"), titleEdit);
titleEdit->setPlaceholderText(i18n("Note title"));
form->addRow(i18n("Title:"), titleEdit);
auto *tagsEdit = new QLineEdit();
tagsEdit->setPlaceholderText(QStringLiteral("tag1, tag2, tag3"));
form->addRow(QStringLiteral("Tags:"), tagsEdit);
tagsEdit->setPlaceholderText(i18n("tag1, tag2, tag3"));
form->addRow(i18n("Tags:"), tagsEdit);
auto *sigEdit = new QLineEdit();
sigEdit->setPlaceholderText(QStringLiteral("(optional)"));
form->addRow(QStringLiteral("Signature:"), sigEdit);
sigEdit->setPlaceholderText(i18n("(optional)"));
form->addRow(i18n("Signature:"), sigEdit);
auto *extCombo = new QComboBox();
extCombo->addItem(QStringLiteral("Markdown"), QStringLiteral(".md"));
extCombo->addItem(QStringLiteral("Emacs org-mode"), QStringLiteral(".org"));
extCombo->addItem(QStringLiteral("Plain Text"), QStringLiteral(".txt"));
form->addRow(QStringLiteral("Format:"), extCombo);
extCombo->addItem(i18n("Markdown"), QStringLiteral(".md"));
extCombo->addItem(i18n("Emacs org-mode"), QStringLiteral(".org"));
extCombo->addItem(i18n("Plain Text"), QStringLiteral(".txt"));
form->addRow(i18n("Format:"), extCombo);
layout->addLayout(form);

58
po/de/kdenote.po Normal file
View File

@ -0,0 +1,58 @@
# German translations for kdenote
# Copyright (C) 2026
# This file is distributed under the same license as the kdenote package.
#
msgid ""
msgstr ""
"Project-Id-Version: kdenote 0.1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-07-12 00:00+0000\n"
"PO-Revision-Date: 2026-07-12 00:00+0000\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "New Denote File..."
msgstr "Neue Denote-Datei..."
msgid "Rename with Denote..."
msgstr "Mit Denote umbenennen..."
msgid "Rename with Denote"
msgstr "Mit Denote umbenennen"
msgid "New Denote File"
msgstr "Neue Denote-Datei"
msgid "Title:"
msgstr "Titel:"
msgid "Tags:"
msgstr "Schlagw\xc3\xb6rter:"
msgid "Signature:"
msgstr "Signatur:"
msgid "Format:"
msgstr "Format:"
msgid "tag1, tag2, tag3"
msgstr "tag1, tag2, tag3"
msgid "(optional)"
msgstr "(optional)"
msgid "Note title"
msgstr "Notiz-Titel"
msgid "Markdown"
msgstr "Markdown"
msgid "Emacs org-mode"
msgstr "Emacs Org-Mode"
msgid "Plain Text"
msgstr "Klartext"