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++
Qt6: Fix app translations
Freya Lupen56767656899b
diff --git a/krita/main.cc b/krita/main.ccindex a330f0e601..7ea7300a22 100644--- a/krita/main.cc+++ b/krita/main.cc@@ -33,6 +33,8 @@#include <QTranslator>#include <QImageReader>+#include <kaboutdata.h>+#include <KisApplication.h>#include <KisMainWindow.h>#include <KisSupportedArchitectures.h>@@ -43,6 +45,7 @@#include <kis_debug.h>#include <kis_image_config.h>#include <opengl/kis_opengl.h>+#include "KritaVersionWrapper.h"#include "KisApplicationArguments.h"#include "KisDocument.h"@@ -649,6 +652,25 @@ if (!qEnvironmentVariableIsEmpty("KRITA_OPENGL_DEBUG")) {dbgLocale << "Available translations" << KLocalizedString::availableApplicationTranslations();dbgLocale << "Available domain translations" << KLocalizedString::availableDomainTranslations("krita");+ /// Initialize application info, it will be used by both, Qt and+ /// DrKonqi of the host system+ KAboutData aboutData("krita",+ i18n("Krita"),+ KritaVersionWrapper::versionString(true),+ i18n("Krita is the full-featured digital art studio"),+ KAboutLicense::GPL,+ i18nc("@info:credit", "© 1999–2026 The Krita Developers"));+ aboutData.setHomepage(QStringLiteral("https://krita.org"));+ aboutData.setOrganizationDomain("krita.org");++ // this call sets corresponding fields of QApplication as well+ KAboutData::setApplicationData(aboutData);++ // Note: Qt docs suggest we set organization name, but if we do, we get resource+ // paths of the form of krita/krita, which is weird.+ KIS_SAFE_ASSERT_RECOVER(app.organizationName().isEmpty()) {+ app.setOrganizationName("");+ }#ifdef Q_OS_WINQDir appdir(KoResourcePaths::getApplicationRoot());diff --git a/libs/ui/KisApplication.cpp b/libs/ui/KisApplication.cppindex aa4e32af33..3275c68ca2 100644--- a/libs/ui/KisApplication.cpp+++ b/libs/ui/KisApplication.cpp@@ -44,7 +44,6 @@#include <kdesktopfile.h>#include <kconfig.h>#include <kconfiggroup.h>-#include <kaboutdata.h>#include <KoDockRegistry.h>#include <KoToolRegistry.h>@@ -84,7 +83,6 @@#include "KisViewManager.h"#include <KisUsageLogger.h>-#include <KritaVersionWrapper.h>#include <dialogs/KisSessionManagerDialog.h>#include <KisResourceCacheDb.h>@@ -233,45 +231,6 @@ KisApplication::KisApplication(const QString &key, int &argc, char **argv)QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath());- // Setting the application info via KAboutData makes translations stop- // working on Android. No clue why, KAboutData also just sets the same- // information and the values end up being the same. But the reason we do- // this is because of DrKonqi, who only exists on KDE, so there's no point- // in taking this detour elsewhere. Since it only has a negative effect on- // Android and works fine on other systems, only that's excluded here.-#ifdef Q_OS_ANDROID- setApplicationDisplayName("Krita");- setApplicationName("krita");- // Note: Qt docs suggest we set this, but if we do, we get resource paths of the form of krita/krita, which is weird.- // setOrganizationName("krita");- setOrganizationDomain("krita.org");- QString version = KritaVersionWrapper::versionString(true);- setApplicationVersion(version);-#else- {- /// Initialize application info, it will be used by both, Qt and- /// DrKonqi of the host system-- KAboutData aboutData("krita",- i18n("Krita"),- KritaVersionWrapper::versionString(true),- i18nc("@title", "Krita is the full-featured digital art studio"),- KAboutLicense::GPL,- i18nc("@info:credit", "© 1999–2026 The Krita Developers"));- aboutData.setHomepage(QStringLiteral("https://krita.org"));- aboutData.setOrganizationDomain("krita.org");-- // this call sets corresponding fields of QApplication as well- KAboutData::setApplicationData(aboutData);-- // Note: Qt docs suggest we set organization name, but if we do, we get resource- // paths of the form of krita/krita, which is weird.- KIS_SAFE_ASSERT_RECOVER(this->organizationName().isEmpty()) {- this->setOrganizationName("");- }- }-#endif-#ifndef Q_OS_MACOSsetWindowIcon(KisIconUtils::loadIcon("krita-branding"));#endif