Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: from linuxdeepin/dtkgui #91

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/kernel/dguiapplicationhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1682,17 +1682,24 @@ bool DGuiApplicationHelper::loadTranslator(const QList<QLocale> &localeFallback)
#else
auto qTranslationsPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
#endif
loadTranslator("qt", {qTranslationsPath}, localeFallback);
loadTranslator("qtbase", {qTranslationsPath}, localeFallback);

DCORE_USE_NAMESPACE
QList<QString> translateDirs;
auto appName = qApp->applicationName();
//("/home/user/.local/share", "/usr/local/share", "/usr/share")
auto dataDirs = DStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
QList<QString> qtranslateDirs = { qTranslationsPath };
for (const auto &path : dataDirs) {
DPathBuf pathBuf(path);
qtranslateDirs << (pathBuf / "qt" QT_STRINGIFY(QT_VERSION_MAJOR) / "translations").toString();
}

loadTranslator("qt", qtranslateDirs, localeFallback);
loadTranslator("qtbase", qtranslateDirs, localeFallback);

QList<QString> translateDirs;
auto appName = qApp->applicationName();
for (const auto &path : dataDirs) {
DPathBuf DPathBuf(path);
translateDirs << (DPathBuf / appName / "translations").toString();
DPathBuf pathBuf(path);
translateDirs << (pathBuf / appName / "translations").toString();
}

// ${translateDir}/${appName}_${localeName}.qm
Expand Down
Loading