Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make desktop files translatable #604

Closed
wants to merge 1 commit into from

Conversation

AsciiWolf
Copy link
Contributor

Probably won't work until #597 gets fixed, but let's add them there.

@mike-fabian
Copy link
Owner

Is translating the gschema file useful? Does anybody read the gschema.xml files? Or do the texts from the gschema.xml files show up in some user interface? I don’t know a the moment.

@mike-fabian mike-fabian self-assigned this Jan 18, 2025
@AsciiWolf
Copy link
Contributor Author

Is translating the gschema file useful? Does anybody read the gschema.xml files? Or do the texts from the gschema.xml files show up in some user interface? I don’t know a the moment.

As far as I know, they show up in tools such as Dconf Editor, and they usually are translated in GNOME and related apps.

@mike-fabian
Copy link
Owner

Is translating the gschema file useful? Does anybody read the gschema.xml files? Or do the texts from the gschema.xml files show up in some user interface? I don’t know a the moment.

As far as I know, they show up in tools such as Dconf Editor, and they usually are translated in GNOME and related apps.

I tried to check how this looks like when using dconf-editor:

Screenshot

Surprisingly it just says "No schema found" for all typing-booster dconf/gsettings options.

It correctly shows all the options but does not even show the English texts. Weird, what could be the reason for that?

@AsciiWolf
Copy link
Contributor Author

It correctly shows all the options but does not even show the English texts. Weird, what could be the reason for that?

Interesting. To be honest, I have no idea. :-/ The gschema file looks correct.

@mike-fabian
Copy link
Owner

It correctly shows all the options but does not even show the English texts. Weird, what could be the reason for that?

Interesting. To be honest, I have no idea. :-/ The gschema file looks correct.

How does it look for you when you do this with dconf-editor?

@AsciiWolf
Copy link
Contributor Author

AsciiWolf commented Jan 18, 2025

How does it look for you when you do this with dconf-editor?

$ rpm -q ibus-typing-booster
ibus-typing-booster-2.27.8-1.fc41.noarch

screenshot

The typing-booster namespace is completely missing.

The file itself however seems to be installed in a correct place:

$ file /usr/share/glib-2.0/schemas/org.freedesktop.ibus.engine.typing-booster.gschema.xml
/usr/share/glib-2.0/schemas/org.freedesktop.ibus.engine.typing-booster.gschema.xml: XML 1.0 document, Unicode text, UTF-8 text

Looks like the typing-booster gschema file gets ignored for some reason (most likely because it contains something invalid).

@mike-fabian
Copy link
Owner

For me this namespace is not missing:

Screenshot

@AsciiWolf
Copy link
Contributor Author

That's strange. org.freedesktop.ibus.engine.m17n is also missing in dconf-editor on my system. When I compare the m17n and typing-booster gschemas with the other ones, there is one difference: They do not contain path= in their schema tag, only id. Maybe that's the reason why they do not show up? Take a look at the gnome-software schema tag.

@mike-fabian
Copy link
Owner

Peek.2025-01-18.22-18.mp4

@mike-fabian
Copy link
Owner

That's strange. org.freedesktop.ibus.engine.m17n is also missing in dconf-editor on my system. When I compare the m17n and typing-booster gschemas with the other ones, there is one difference: They do not contain path= in their schema tag, only id. Maybe that's the reason why they do not show up? Take a look at the gnome-software schema tag.

The path= tag is missing for a reason:

ibus-m17n, ibus-table, and ibus-typing-booster offer many different engines which share the same schema but have different paths. The schema path is set dynamically at run time, for example here:

https://github.com/mike-fabian/ibus-typing-booster/blob/main/engine/hunspell_table.py#L142

        schema_path = '/org/freedesktop/ibus/engine/typing-booster/'
        if self._engine_name != 'typing-booster':
            try:
                match = itb_util.M17N_ENGINE_NAME_PATTERN.search(
                        self._engine_name)
                if not match:
                    raise ValueError('Invalid engine name.')
                self._m17n_ime_lang = match.group('lang')
                self._m17n_ime_name = match.group('name')
                symbol = ''
                for pattern, pattern_symbol in itb_util.M17N_IME_SYMBOLS:
                    if re.fullmatch(pattern, self._engine_name):
                        symbol = pattern_symbol
                        break
                self._input_mode_true_symbol = symbol
                self._input_mode_false_symbol = '•' + symbol
                schema_path = ('/org/freedesktop/ibus/engine/tb/'
                               f'{self._m17n_ime_lang}/{self._m17n_ime_name}/')

Similar for ibus-table and ibus-m17n.

@AsciiWolf
Copy link
Contributor Author

Peek.2025-01-18.22-18.mp4

What OS are you using? I am running (fully updated) Fedora 41.

@mike-fabian
Copy link
Owner

The number of engines available varies, for ibus-m17n and ibus-typing-booster it depends on which .mim files are available in /usr/share/m17n:

$ ls /usr/share/m17n/*mim | wc 
    209     209    6617

As you can see there are a lot of them.

Example:

Peek.2025-01-18.22-18.mp4

What OS are you using? I am running (fully updated) Fedora 41.

Same, the OS in the video is a fully updated Fedora 41 running in a qemu virtual machine, XFCE desktop.

@mike-fabian
Copy link
Owner

An example for an m17n-db input method offered by ibus-typing-booster and ibus-m17n:

mfabian@hathi:~
$ ls /usr/share/m17n/latn-post.mim 
/usr/share/m17n/latn-post.mim
mfabian@hathi:~
$ ibus list-engine | grep latn-post 
  tb:t:latn-post - t-latn-post (tb)
  m17n:t:latn-post - t-latn-post (m17n)
mfabian@hathi:~
$ dconf dump /org/freedesktop/ibus/engine/m17n/t/latn-post/
[/]
lookup-table-orientation=1
preedit-background='#F9F06B'
preedit-foreground='#EA340A'
preedit-underline=2
use-us-layout=false
mfabian@hathi:~
$ dconf dump /org/freedesktop/ibus/engine/tb/t/latn-post/
[/]
addspaceoncommit=true
arrowkeysreopenpreedit=false
asciidigits=false
...

@mike-fabian
Copy link
Owner

And it is also possible to add even more m17n-db input methods in the users home directory, for example I have a tokipona input method here:

mfabian@hathi:~
$ ls ~/.m17n.d/tokipona.mim
/home/mfabian/.m17n.d/tokipona.mim
mfabian@hathi:~

Supported by both ibus-m17n and ibus-typing-booster:

mfabian@hathi:~
$ ibus list-engine | grep tok 
  tb:tok:tokipona - tok-tokipona (tb)
  m17n:tok:tokipona - tok-tokipona (m17n)
mfabian@hathi:~

These dconf/gsettings are created dynamically at runtime, it is enough to put such an input method into ~/.m17n.d/ and restart ibus, then ibus list-engine will find it, you can add it using ibus-setup on non-Gnome desktops or using the Gnome control centre on Gnome desktops. Then you can open the setup tool for these engines, change some settings, and then you will have user settings like in these examples:'

mfabian@hathi:~
$ dconf dump /org/freedesktop/ibus/engine/m17n/tok/
[tokipona]
lookup-table-orientation=2
preedit-background='#C7C7EF'
preedit-foreground='#000000'
preedit-underline=1
use-us-layout=false
mfabian@hathi:~
$ dconf dump /org/freedesktop/ibus/engine/tb/tok/
[tokipona]
addspaceoncommit=true
offtherecord=true
preeditunderline=1
tabenable=true
mfabian@hathi:~
$ 

@mike-fabian
Copy link
Owner

All the many ibus-typing-booster engines share the same schema file because they all have the same possible settings (Although some set different defaults at runtime then the defaults in the schema file). But the paths have to be different because one can user several engines and set the options differently for each engine.

@mike-fabian
Copy link
Owner

That's strange. org.freedesktop.ibus.engine.m17n is also missing in dconf-editor on my system. When I compare the m17n and typing-booster gschemas with the other ones, there is one difference: They do not contain path= in their schema tag, only id. Maybe that's the reason why they do not show up? Take a look at the gnome-software schema tag.

I think I understand now why /org/freedesktop/ibus/engine/m17n/ and /org/freedesktop/ibus/engine/typing-booster/ and /org/freedesktop/ibus/engine/tb/ are missing in your dconf-editor:

You probably never used any of these engines, and if you have used any of them, then you did not change any user settings. Therefore there is nothing in the user settings for any of these engines and then dconf-editor shows nothing.

Look at this example screenshot:

Screenshot

You see that at /org/freedesktop/ibus/engine/tb/ I have only the subfolders hi, mai, and t.

Because these are the only tb engines I have used and changed settings in that virtual machine.

Therefore, dconf dump also lists only stuff for these 3 subfolders on that machine:

mfabian@f41:~$ dconf dump /org/freedesktop/ibus/engine/tb/ | grep '^\[' 
[hi/inscript2]
[hi/itrans]
[mai/inscript]
[mai/inscript2]
[t/latn-post]
[t/rfc1345]
mfabian@f41:~$ 

@AsciiWolf
Copy link
Contributor Author

Ah, that makes sense! I have not used them on this machine.

@mike-fabian
Copy link
Owner

Here in this video, I add another one, tb:cs:kbd - cs-kbd (tb). After adding it, I select it in the panel. Open the panel again and open the setup tool, change at least one setting.

After doing that, dconf dump shows [cs/kbd] as well:

mfabian@f41:~$ dconf dump /org/freedesktop/ibus/engine/tb/ | grep '^\[' 
[cs/kbd]
[hi/inscript2]
[hi/itrans]
[mai/inscript]
[mai/inscript2]
[t/latn-post]
[t/rfc1345]
mfabian@f41:~$ 
mfabian@f41:~$ dconf dump /org/freedesktop/ibus/engine/tb/cs/kbd/
[/]
addspaceoncommit=true
offtherecord=true
preeditunderline=1
tabenable=true
mfabian@f41:~$ 

And in dconf-editor, a new cs subfolder appears under tb:

Peek.2025-01-18.23-01.mp4

@mike-fabian
Copy link
Owner

I am afraid dconf-editor will not show these text from the gschema.xml file then if that gschema.xml file is used for many paths set at runtime. Not sure whether it is even possible to fix that in dconf-editor. I can change this settings without problems using dconf-editor, I just cannot see the text explaining the settings from the gschema.xml.

If it is not possible to fix that for dconf-editor, we might be translating a lot of strings for nothing.

That is a pity though, I wonder whether this can be fixed somehow ...

@AsciiWolf AsciiWolf changed the title Make remaining desktop and gschema files translatable Make desktop files translatable Jan 18, 2025
@AsciiWolf
Copy link
Contributor Author

I have removed the gschema file from POTFILES.in. We can add it later, in a separate PR.

@mike-fabian
Copy link
Owner

mike-fabian added a commit that referenced this pull request Jan 19, 2025
…tup tool

Related: #604

This pull request originally wanted to make the schema file translatable
as well. That turned out to be useless at the moment as no tools
seem to be able to display texts from schema files when dynamic paths
are used. Typing Booster has to use dynamic paths as it offers many engines
which share the same schema file but can have different settings.

At the moment dconf-editor apparently cannot display texts from a
schema file at all if the schema file has no static path. I have no
idea whether it is possible fix this in dconf and as long as there are
no tools reading and displaying the texts from the schema file,
translating it seems useless.

But if this ever changes and we want to translate the schema file, the
texts in the schema file should not gratuitously differ from the texts
in the setup tool.  If the texts are identical as far as possible,
this reduces the work for the translators.

I had already started making the texts in the schema file identical to
those in the setup tool before I realized that translations is useless
at the moment.

Committing these changes anyway cannot hurt, it might be helpful if
the situation changes and translating the schema file becomes useful.
mike-fabian added a commit that referenced this pull request Jan 19, 2025
@mike-fabian
Copy link
Owner

@AsciiWolf

Generating translations into the desktop files works now.

I changed the comment in the emoji-picker.desktop.in.in to the same string as in the metainfo.xml to make translations reusable:

-Comment=An emoji selection tool
+Comment=Emoji browsing tool

So Czech is already there in the generated emoji-picker.desktop:

mfabian@hathi:/local/mfabian/src/ibus-typing-booster/engine (release-candidate-2.27.10 $)
$ cat emoji-picker.desktop
[Desktop Entry]
Name[ar]=منتقي الإيموجي
Name[bn]=ইমোজি বাছাইকারী
Name[ca]=Selector d’emojis
Name[cs]=Výběr emodži
Name[de]=Emoji Auswahl
Name[es]=Selector de emoyis
Name[fr]=Présentoir à émoticônes
Name[he]=בוחר אמוג׳י
Name[hu]=Emodzsiválasztó
Name[it]=Selettore Emoji
Name[ja]=絵文字の選択
Name[ka]=ემოჯის არჩევა
Name[lt]=Jaustukų rinkiklis
Name[nl]=Emoji-kiezer
Name[or]=ଇମୋଜି ବଛାରି
Name[pl]=Wybieranie emoji
Name[pt]=Emoji Seletor
Name[pt_BR]=Seletor de emoji
Name[ru]=Подборка эмодзи
Name[sv]=Emoji-väljare
Name[sw]=Kichaguzi Cha Emoji
Name[tr]=Emoji Seçici
Name[uk]=Вибір емодзі
Name[zh_CN]=Emoji 选择器
Name[kab]=Amefran n yimujiten
Name=Emoji Picker
Comment[cs]=Nástroj pro prohlížení emodži
Comment[de]=Emoji-Suchwerkzeug
Comment[ja]=絵文字検索ツール
Comment[ka]=ემოჯების დასათვალიერებელი პროგრამა
Comment[tr]=Emoji görüntüleme aracı
Comment=Emoji browsing tool
Exec=/usr/bin/emoji-picker
Icon=ibus-typing-booster
Terminal=false
Type=Application
StartupNotify=true
Categories=GTK;Utility;
mfabian@hathi:/local/mfabian/src/ibus-typing-booster/engine (release-candidate-2.27.10 $)
$ 

For the ibus-setup-typing-booster.desktop I was unable to reuse existing strings, so that needs two new strings translated, see:

https://translate.fedoraproject.org/translate/ibus-typing-booster/-/cs/?q=state:%3Ctranslated

mfabian@hathi:/local/mfabian/src/ibus-typing-booster/setup (release-candidate-2.27.10 *$)
$ cat ibus-setup-typing-booster.desktop
[Desktop Entry]
Name[de]=Einstellungen für Typing Booster
Name[ja]=タイピングブースターの設定
Name=Typing Booster Preferences
Comment[de]=Typing Booster-Optionen festlegen
Comment[ja]=タイピングブースターのオプションを設定する
Comment=Set Typing Booster Options
Exec=/usr/libexec/ibus-setup-typing-booster
Icon=ibus-typing-booster
NoDisplay=true
Type=Application
StartupNotify=true
mfabian@hathi:/local/mfabian/src/ibus-typing-booster/setup (release-candidate-2.27.10 *$)
$ 

@mike-fabian
Copy link
Owner

@AsciiWolf Thank you, that worked!:

mfabian@hathi:/local/mfabian/src/ibus-typing-booster/setup (release-candidate-2.27.10 *$)
$ cat ibus-setup-typing-booster.desktop
[Desktop Entry]
Name[cs]=Předvolby Urychlovače psaní
Name[de]=Einstellungen für Typing Booster
Name[ja]=タイピングブースターの設定
Name=Typing Booster Preferences
Comment[cs]=Nastavit možnosti Urychlovače psaní
Comment[de]=Typing Booster-Optionen festlegen
Comment[ja]=タイピングブースターのオプションを設定する
Comment=Set Typing Booster Options
Exec=/usr/libexec/ibus-setup-typing-booster
Icon=ibus-typing-booster
NoDisplay=true
Type=Application
StartupNotify=true
mfabian@hathi:/local/mfabian/src/ibus-typing-booster/setup (release-candidate-2.27.10 *$)
$ 

@mike-fabian
Copy link
Owner

Same procedure for ibus-table, make desktop file translatable and generate translations into desktop file:

mike-fabian/ibus-table@c2a0def

@AsciiWolf
Copy link
Contributor Author

Great, thanks! :-) Please also do it for ibus-m17n if possible.

@mike-fabian
Copy link
Owner

Great, thanks! :-) Please also do it for ibus-m17n if possible.

ibus-m17n already has a translatable desktop file, I think.

@mike-fabian
Copy link
Owner

mfabian@hathi:/local/mfabian/src/ibus-m17n (release-candidate-1.4.35)
$ cat src/ibus-setup-m17n.desktop
[Desktop Entry]
Name[de]=IBus M17n Einstellungen
Name[zh_CN]=IBus M17N 设置
Name[tr]=IBus M17N Kurulumu
Name[uk]=Налаштування M17N IBus
Name[id]=IBus M17N Setup
Name[ja]=IBus M17N の設定
Name[pt_BR]=Configuração do IBus M17N
Name[fr]=Configuration d’IBus M17N
Name[es]=Ajuste IBus M17N
Name[si]=IBus M17N පිහිටුවීම
Name[bn]=আইবাস এম17এন সেটআপ
Name[ar]=إعداد IBus M17N
Name[ka]=IBus M17N -ის მორგება
Name[sv]=Installation av IBus M17N
Name[lt]=IBus M17N sąranka
Name[hi]=आईबीस एम17एन सेटअप
Name[ru]=Настройка IBus M17N
Name[ml]=ഐബസ് എം17എന്‍ സജ്ജീകരണങ്ങള്‍
Name[cs]=Nastavení IBus M17N
Name[el]=Διευθέτηση IBus M17N
Name[kab]=Asesteb IBus M17N
Name=IBus M17N Setup
Comment[de]=IBus M17N Einstellungen
Comment[zh_CN]=设置 IBus M17N 引擎
Comment[tr]=IBus M17N motorunu kur
Comment[uk]=Налаштувати рушій M17N IBus
Comment[id]=Set up IBus M17N mesin
Comment[ja]=IBus M17n エンジンを設定する
Comment[pt_BR]=Configure o motor IBus M17N
Comment[fr]=Configurer le moteur IBus M17N
Comment[es]=Ajuste motor IBus M17N
Comment[si]=IBus M17N යන්ත්‍රය පිහිටුවන්න
Comment[bn]=আইবাস এম17এন ইঞ্জিন সেট আপ করুন
Comment[ar]=إعداد محرك IBus M17N
Comment[ka]=მოირგეთ IBus M17N ძრავა
Comment[sv]=Ställ in IBus M17N-motor
Comment[lt]=Nustatyti IBus M17N modulį
Comment[hi]=आईबीस एम17एन इंजन सेट करें
Comment[ru]=Настройка движка IBus M17N
Comment[ml]=ഐബസ് എം17എന്‍ സജ്ജീകരിക്കുക
Comment[cs]=Nastavte modul IBus M17N
Comment[el]=Διευθέτηση μηχανής IBus M17N
Comment[kab]=Sbadu amsedday IBus M17N
Comment=Set up IBus M17N engine
Exec=/usr/libexec/ibus-setup-m17n
NoDisplay=true
Type=Application
StartupNotify=true
mfabian@hathi:/local/mfabian/src/ibus-m17n (release-candidate-1.4.35)
$ 

mike-fabian added a commit that referenced this pull request Jan 20, 2025
…oids gettext dependency when building from the tarball)

Related: #597
Related: #604
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants