KWin script translations

Hi all.
i’m trying to add translations to a kwin script. I did the following:

  • create a locale dir and subdirs inside contents/ :
    contents/locale/$lang/LC_MESSAGES/$myscriptname.mo
  • Added the X-KWin-Config-TranslationDomain key to metadata.json:
    “X-KWin-Config-TranslationDomain”:“myscriptname”
  • Inside contents/locale/$lang/LC_MESSAGES I’ve created a bunch of *mo files with all the combinations that I’ve been capable:
    myscriptname.mo
    kwin_scripts_myscriptname.mo
    kwin_scripts_myscriptnameConfig.mo
    plasma_applet_myscriptname.mo
    … and so on.
    I know plasma_applet_ should not be the case but just for try…

I’ve been looking for examples but there aren’t, at least I couldn’t find any, and it seems the scripts translation mechanism is not documented at all.
I’ve also tried using a metadata.desktop instead of metadata.json but nothing seems to work.
Any hint?

thanks.

Got it.

  1. Add “X-KWin-Config-TranslationDomain: myscript” to metada.json
  2. Create path for translations at myscript/locale/$LANG/LC_MESSAGES/ where $LANG is the language code (es, ca_AD…)

That’s awesome - if possible, it would be fantastic if you could share that in the KWin scripting documentation as well! The source code for that is here if you’re able :slight_smile: : content/docs/plasma/kwin/_index.md · master · Documentation / Developer Tutorial and Article Site · GitLab

I’ll do it, sure. I’ve lost too much time trying to get it working. It’s simple and works great when you know how to do it so it needs to be documented elsewhere so anyone can add translations without spend time reading code and git commits :wink:

1 Like