helloSystem / Menu

Global menu bar written in Qt
43 stars 14 forks source link

Make translatable #61

Open probonopd opened 3 years ago

probonopd commented 3 years ago

Make the menu and its plug-ins translatable via Weblate on https://hosted.weblate.org/projects/hellosystem/menu/.

I have started working toward this end roughly along https://doc.qt.io/qt-5/qtlinguist-hellotr-example.html but it seems not to be working correctly yet. (Unfortunately the example does not describe CMakeLists.txt.)

Most likely I made some mistakes in https://github.com/helloSystem/Menu/commit/04c4b445172cbd597acaeb4358e03853a5110b2c? Any help appreciated.

probonopd commented 3 years ago

The German translations for e.g., "About This Computer" are not shown.

sudo -E truss ./menubar shows that the German translation file is opened successfully on a German system:

(...)
access("/System/Menu.AppDir/usr/bin/../share/menubar/translations/menubar_de.qm",R_OK) = 0 (0x0)
fstatat(AT_FDCWD,"/System/Menu.AppDir/usr/bin/../share/menubar/translations/menubar_de.qm",{ mode=-r--r--r-- ,inode=557540,size=1237,blksize=4096 },0x0) = 0 (0x0)
openat(AT_FDCWD,"/System/Menu.AppDir/usr/bin/../share/menubar/translations/menubar_de.qm",O_RDONLY|O_CLOEXEC,00) = 32 (0x20)
fstat(32,{ mode=-r--r--r-- ,inode=557540,size=1237,blksize=4096 }) = 0 (0x0)
fstat(32,{ mode=-r--r--r-- ,inode=557540,size=1237,blksize=4096 }) = 0 (0x0)
(...)

So far this looks good. But:

strings /System/Menu.AppDir/usr/bin/../share/menubar/translations/menubar_de.qm suggests that the strings are only contained in English and the German translations are not in there at all:

% strings /System/Menu.AppDir/usr/bin/../share/menubar/translations/menubar_de.qm
de_DEB
About This Computer
AppMenuWidget
Log Out
(...)

What are we doing wrong? Why are the German translations not contained in menubar_de.qm at all? Possibly some mistake in the CMake translation-related stuff in https://github.com/helloSystem/Menu/commit/04c4b445172cbd597acaeb4358e03853a5110b2c?

kettle-7 commented 3 years ago

Strange. I've only dealt with Qt TR files before, and even then I haven't done much with them.