Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2:Ports
ki18n
fallbackLang.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fallbackLang.diff of Package ki18n
diff --git a/src/kcatalog.cpp b/src/kcatalog.cpp index a85b6bb..f606c9e 100644 --- a/src/kcatalog.cpp +++ b/src/kcatalog.cpp @@ -110,26 +110,51 @@ KCatalog::~KCatalog() QString KCatalog::catalogLocaleDir(const QByteArray &domain, const QString &language) { + QStringList localeDirs; + QString localeDir; QString relpath = QStringLiteral("%1/LC_MESSAGES/%2.mo") .arg(language, QFile::decodeName(domain)); + + // Specific SUSE kf5 location ; bundle-lang-bla ; update-translations ; generic + localeDirs << QStringLiteral("/usr/share/locale/kf5/") << QStringLiteral("/usr/share/locale-bundle/kf5/") << QStringLiteral("/usr/share/locale-bundle/") << QStringLiteral("/usr/share/locale-langpack/"); + + foreach (const QString &locDir, localeDirs) { + QFile file(locDir + relpath); + if (file.exists()) { + return locDir; + } + } + // Check the standard locations QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, - QStringLiteral("locale/") + relpath); - QString localeDir; - if (file.isEmpty()) { - localeDir = QString(); - } else { - // Path of the locale/ directory must be returned. + QStringLiteral("locale/") + relpath); + if (!file.isEmpty()) { localeDir = QFileInfo(file.left(file.size() - relpath.size())).absolutePath(); + return localeDir; } + // No translation around + localeDir = QString(); return localeDir; } QSet<QString> KCatalog::availableCatalogLanguages(const QByteArray &domain_) { QString domain = QFile::decodeName(domain_); - QStringList localeDirPaths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, - QStringLiteral("locale"), - QStandardPaths::LocateDirectory); + QStringList localeDirPaths; + QStringList localeDirs; + + // Specific SUSE kf5 location ; bundle-lang-bla ; update-translations ; generic + localeDirs << QStringLiteral("/usr/share/locale/kf5") << QStringLiteral("/usr/share/locale-bundle/kf5") << QStringLiteral("/usr/share/locale-bundle") << QStringLiteral("/usr/share/locale-langpack"); + + foreach (const QString &localeDir, localeDirs) { + QDir locDir(localeDir); + if (locDir.exists()) { + localeDirPaths.append(localeDir); + } + } + QStringList localeFallbackDirPaths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + QStringLiteral("locale"), + QStandardPaths::LocateDirectory); + localeDirPaths.append(localeFallbackDirPaths); QSet<QString> availableLanguages; foreach (const QString &localDirPath, localeDirPaths) { QDir localeDir(localDirPath);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor