D10219: Load translations from KPackage files if bundled
Chris Holland
noreply at phabricator.kde.org
Thu Feb 1 00:01:36 UTC 2018
Zren created this revision.
Zren added a reviewer: Plasma.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.
Zren requested review of this revision.
REVISION SUMMARY
Based on https://phabricator.kde.org/D5209, which adds this feature to plasma-framework.
-----
https://phabricator.kde.org/D5209
TEST PLAN
Assuming `/usr/share/locale/fr/LC_MESSAGES/plasma_applet_org.kde.plasma.digitalclock.mo` exists.
- `LANGUAGE=fr plasmoidviewer -a org.kde.plasma.digitalclock`
- `i18n()` strings are translated into french.
- Qt datetime formatting (`Qt.formatDate(tzDate,"dddd")`) like in digitalclock's tooltip **uses the system locale**.
- `LANG=fr_CA.UTF-8 LANGUAGE=fr plasmoidviewer -a org.kde.plasma.digitalclock`
- `i18n()` strings are translated into french.
- Qt datetime formatting uses the french canadian locale.
Before patch:
- `LANGUAGE=fr plasmoidviewer -a ./package`
- `i18n()` strings are **not translated**.
- `plasmoidviewer -a ./bundle.plasmoid`
- Does not work. Seems it needs to be extracted first for plasmoidviewer to work.
After patch:
First setup a test env that doesn't have translations elsewhere.
cp -r /usr/share/plasma/plasmoids/org.kde.plasma.volume .
cd org.kde.plasma.volume
mkdir -p contents/locale/fr/LC_MESSAGES
rm metadata.json
kwriteconfig5 --file "$(realpath metadata.desktop)" --group "Desktop Entry" --key "X-KDE-PluginInfo-Name" "org.kde.plasma.volumetest"
cd contents/locale/fr/LC_MESSAGES
cp /usr/share/locale/fr/LC_MESSAGES/plasma_applet_org.kde.plasma.volume.mo .
mv plasma_applet_org.kde.plasma.volume.mo plasma_applet_org.kde.plasma.volumetest.mo
cd ../../../..
- `LANGUAGE=fr plasmoidviewer -a .`
- `i18n()` strings are translated into french, loaded from `./package/contents/locale/fr/LC_MESSAGES/plasma_applet_na.me.space.mo`
- Tested when `contents/locale` doesn't exist.
- Tested when `metadata.desktop` and `metadata.json` doesn't exist.
REPOSITORY
R118 Plasma SDK
REVISION DETAIL
https://phabricator.kde.org/D10219
AFFECTED FILES
plasmoidviewer/view.cpp
To: Zren, #plasma
Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180201/4d11f923/attachment.html>
More information about the Plasma-devel
mailing list