Enable scripted effects to load config translations from the kpackage
By default translations are loaded from /usr/share/locale. This works fine for builtin effects since we install our translations there. However, it doesn't work for third-party scripted effects. They only provide a kpackage and can't install anything to /usr/share/. This patch allows them to ship translations in contents/locale/$language/LC_MESSAGES/$domain.mo, where $domain is the X-KWin-Config-TranslationDomain metadata value This matches what Plasma does for applets since https://phabricator.kde.org/D5209 CCBUG: 317338
This commit is contained in:
parent
a40dd9a158
commit
54e384e68e
1 changed files with 5 additions and 0 deletions
|
@ -97,6 +97,11 @@ void GenericScriptedConfig::createUi()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString localePath = packageRoot + QLatin1String("/contents/locale");
|
||||||
|
if (QFileInfo::exists(localePath)) {
|
||||||
|
KLocalizedString::addDomainLocaleDir(metaData.value("X-KWin-Config-TranslationDomain").toUtf8(), localePath);
|
||||||
|
}
|
||||||
|
|
||||||
QFile xmlFile(kconfigXTFile);
|
QFile xmlFile(kconfigXTFile);
|
||||||
KConfigGroup cg = configGroup();
|
KConfigGroup cg = configGroup();
|
||||||
KConfigLoader *configLoader = new KConfigLoader(cg, &xmlFile, this);
|
KConfigLoader *configLoader = new KConfigLoader(cg, &xmlFile, this);
|
||||||
|
|
Loading…
Reference in a new issue