Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Fix translations for standard actions
Dmitry Kazakov5201fe7b1543
diff --git a/libs/widgetutils/config/kstandardaction.cpp b/libs/widgetutils/config/kstandardaction.cppindex 4b37d7f78b..ff5d5e0da6 100644--- a/libs/widgetutils/config/kstandardaction.cpp+++ b/libs/widgetutils/config/kstandardaction.cpp@@ -97,17 +97,17 @@ QAction *create(StandardAction id, const QObject *recvr, const char *slot, QObjecase Preferences:case AboutApp:case HelpContents: {- QString appDisplayName = QGuiApplication::applicationDisplayName();- if (appDisplayName.isEmpty()) {- appDisplayName = QCoreApplication::applicationName();- }- sLabel = i18n(pInfo->psLabel, appDisplayName);+ // in Krita we have the application name baked into the translation+ // string, so just fetch it directly+ sLabel = i18nc("action", pInfo->psLabel);}break;default:- sLabel = i18n(pInfo->psLabel);+ sLabel = i18nc("action", pInfo->psLabel);}++if (QApplication::isRightToLeft()) {switch (id) {case Prior: iconName = "go-next-view-page"; break;diff --git a/libs/widgetutils/config/kstandardaction_p.h b/libs/widgetutils/config/kstandardaction_p.hindex 9d0a29b824..bce6f5b1d3 100644--- a/libs/widgetutils/config/kstandardaction_p.h+++ b/libs/widgetutils/config/kstandardaction_p.h@@ -27,6 +27,22 @@ struct KStandardActionInfo {};+/**+ * TODO: this file is wrong! QT_TRANSLATE_NOOP macro is **not** used by KDE macros,+ * hence the strings defined in `g_rgActionInfo` are **never** translated!+ *+ * Some of them work by pure coincidence, because kritamenu.action defines the exact+ * copies of them, which are extracted. Though these copies use "action" context, which+ * is explicitly requested in KStandardAction::create().+ *+ * Some others, like KStandardShortcut::ConfigureToolbars, work because the action is+ * explicitly created inside Krita in KisMainWindow::createActions() and propertized+ * via the strings from kritamenu.action.+ *+ * Ideally we should switch back to the upstream version of KConfigWidgets and reuse+ * the strings provided by KDE.+ */+// clang-format offstatic constexpr KStandardActionInfo g_rgActionInfo[] = {@@ -89,17 +105,17 @@ static constexpr KStandardActionInfo g_rgActionInfo[] = {{ ShowStatusbar, KStandardShortcut::ShowStatusbar, "options_show_statusbar", QT_TRANSLATE_NOOP("KStandardActions", "Show St&atusbar"), QT_TRANSLATE_NOOP("KStandardActions", "Show or hide statusbar"), {} },{ FullScreen, KStandardShortcut::FullScreen, "fullscreen", QT_TRANSLATE_NOOP("KStandardActions", "F&ull Screen Mode"), {}, "view-fullscreen" },{ KeyBindings, KStandardShortcut::KeyBindings, "options_configure_keybinding", QT_TRANSLATE_NOOP("KStandardActions", "Configure Keyboard S&hortcuts…"), {}, "configure-shortcuts" },- { Preferences, KStandardShortcut::Preferences, "options_configure", QT_TRANSLATE_NOOP("KStandardActions", "&Configure %1…"), {}, "configure" },+ { Preferences, KStandardShortcut::Preferences, "options_configure", QT_TRANSLATE_NOOP("KStandardActions", "&Configure Krita..."), {}, "configure" },{ ConfigureToolbars, KStandardShortcut::ConfigureToolbars, "options_configure_toolbars", QT_TRANSLATE_NOOP("KStandardActions", "Configure Tool&bars…"), {}, "configure-toolbars" },{ ConfigureNotifications, KStandardShortcut::ConfigureNotifications, "options_configure_notifications", QT_TRANSLATE_NOOP("KStandardActions", "Configure &Notifications…"), {}, "preferences-desktop-notification" },// the idea here is that Contents is used in menus, and Help in dialogs, so both share the same// shortcut- { HelpContents, KStandardShortcut::Help, "help_contents", QT_TRANSLATE_NOOP("KStandardActions", "%1 &Handbook"), {}, "help-contents" },+ { HelpContents, KStandardShortcut::Help, "help_contents", QT_TRANSLATE_NOOP("KStandardActions", "Krita &Handbook"), {}, "help-contents" },{ WhatsThis, KStandardShortcut::WhatsThis, "help_whats_this", QT_TRANSLATE_NOOP("KStandardActions", "What's &This?"), {}, "help-contextual" },- { ReportBug, KStandardShortcut::ReportBug, "help_report_bug", QT_TRANSLATE_NOOP("KStandardActions", "&Report Bug…"), {}, "tools-report-bug" },- { SwitchApplicationLanguage, KStandardShortcut::SwitchApplicationLanguage, "switch_application_language", QT_TRANSLATE_NOOP("KStandardActions", "Configure &Language…"), {}, "preferences-desktop-locale" },- { AboutApp, KStandardShortcut::AccelNone, "help_about_app", QT_TRANSLATE_NOOP("KStandardActions", "&About %1"), {}, nullptr },+ { ReportBug, KStandardShortcut::ReportBug, "help_report_bug", QT_TRANSLATE_NOOP("KStandardActions", "&Report Bug..."), {}, "tools-report-bug" },+ { SwitchApplicationLanguage, KStandardShortcut::SwitchApplicationLanguage, "switch_application_language", QT_TRANSLATE_NOOP("KStandardActions", "Switch Application &Language..."), {}, "preferences-desktop-locale" },+ { AboutApp, KStandardShortcut::AccelNone, "help_about_app", QT_TRANSLATE_NOOP("KStandardActions", "&About Krita"), {}, nullptr },{ AboutKDE, KStandardShortcut::AccelNone, "help_about_kde", QT_TRANSLATE_NOOP("KStandardActions", "About &KDE"), {}, "kde" },{ ActionNone, KStandardShortcut::AccelNone, {}, {}, {}, {} },};