It’s in the Name[de]
key of the .desktop file.
Note that files in ~/.local/share/applications
may override the system .desktop file, so look in there as well.
What does work is copying the file from the system dir to ~/.local, commenting out the translation key and giving whatever Name or Name[de].
Problem is you then you get two appicons on the launcher (and probably in the open with dialog as well). One could hide the duplicates in a launcher folder though.
Some apps might use a key X-MeeGo-Translation-Catalog=
and translations will then be in .qm files which you can’t change.
If you reallly want to change it, you could use lconvert
do disassemble .qm files to .ts, edit that, compile it again with lrelease
and replace the shipped .qm file.
If you want to do that,
X-MeeGo-Translation-Catalog=foo
means the translation for German are in /usr/share/translations/foo-de.qm
and X-MeeGo-Logical-Id=bar
is the key in the decompiled .ts file.
Here an example for the messages application in German:
# install the necessary tool
pkcon install qt5-qttools-linguist
### find the keys in the .desktop file:
grep X-MeeGo- /usr/share/applications/jolla-messages.desktop
X-MeeGo-Logical-Id=messages-ap-name
X-MeeGo-Translation-Catalog=messages
Let’s start with creating a working directory:
mkdir ~/Documents/language-override
pushd !$
Convert the qm file into an editable format:
lconvert -target-language de /usr/share/translations/messages-de.qm -o my-messages.ts
Now, edit the .ts file deleting all but the key you want to change, taking care to keep the file valid XML. E.g.:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de">
<context>
<name></name>
<message>
<source>messages-ap-name</source>
<translation>Nachrichten</translation>
</message>
</context>
</TS>
Rename the key and put your new translation:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de">
<context>
<name></name>
<message>
<source>messages-ap-name-custom</source>
<translation>Nchrchtn</translation>
</message>
</context>
</TS>
Compile the ts file into an qm file again:
lrelease my-messages.ts -qm my-messages-de.qm
Combine the custom qm with the original into messages-override:
lconvert -o messages-override-de.qm /usr/share/translations/messages-de.qm my-messages-de.qm
Copy the custom .qm file (this might work with ~/.local/share/translations
, haven’t tried that):
devel-su cp messages-override-de.qm /usr/share/translations/
# or this, taking care of permissions:
# devel-su install -o root -g root -m 0644 messages-override-de.qm /usr/share/translations/messages-override-de.qm
Now you have a custom translation catalog, with a custom key with your translation inside. Final step is to edit the .desktop file to use it:
[Desktop Entry]
Type=Application
Name=Messages
# original:
#X-MeeGo-Logical-Id=messages-ap-name
#X-MeeGo-Translation-Catalog=messages
# custom translation:
X-MeeGo-Logical-Id=messages-ap-name-custom
X-MeeGo-Translation-Catalog=messages-custom
Note that this will of course break multilanguage support for any other languages including plain English unless you do the same steps for the other languages as well.
Fortunately only the app you edited the .desktop file of will be affected.