We have moved to a new Sailfish OS Forum. Please start new discussions there.

Revision history [back]

click to hide/show revision 1
initial version

posted 2018-11-18 10:39:07 +0200

Transfer engine locization problem

I have created a transfer engine plugin for the Sailfish OS, and I am facing difficulties with the localisation.

Problem: From the localisation folder always the last qm file got loaded regardless to the system locale

The example suggest that the translations shall be installed to the /usr/share/translations/nemotransferengine https://git.merproject.org/mer-core/transfer-engine/blob/master/example/example.pro#L48

My plugin called smsshareplugin, so I have installed smsshareplugin-hu, pl, sv.qm files to there.

But the loaded plugin ignores the system locale and always loads the last translation in the folder. I know only one similar plugin (with translation) the QR share, and it seems that they were in the same boot back in the 2015: https://github.com/Acce0ss/harbour-qr-share-plugin/issues/1#issuecomment-77699490

In the source code of the open source transfer plugin I have not found any relevant reference to the QTranslator, so I assume the problem is in some other layers.

By looking at the strace when the share is selected in the jolla-notes for e.g. very strange things got loaded (my locale is hu_HU.utf-8 but the situation is the same with other locales):

access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu_HU.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu_HU", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu_hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu_hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm", R_OK) = 0
stat64("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm", {st_mode=S_IFREG|0644, st_size=1068, ...}) = 0
open("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 42
fcntl64(42, F_SETFD, FD_CLOEXEC)        = 0
fstat64(42, {st_mode=S_IFREG|0644, st_size=1068, ...}) = 0
fstat64(42, {st_mode=S_IFREG|0644, st_size=1068, ...}) = 0
read(42, "<\270d\30\312\357\234\225\315!\34\277`\241\275\335", 16) = 16
mmap2(NULL, 1068, PROT_READ, MAP_PRIVATE, 42, 0) = 0xae3ea000
close(42)                               = 0
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu_HU.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu_HU", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu_hu.qm", R_OK) = -1 ENOENT (No such file or directory)
futex(0xb48064f4, FUTEX_WAKE_PRIVATE, 1) = 0
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu_hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm", R_OK) = 0
stat64("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm", {st_mode=S_IFREG|0644, st_size=1131, ...}) = 0
open("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 32
fcntl64(32, F_SETFD, FD_CLOEXEC)        = 0
fstat64(32, {st_mode=S_IFREG|0644, st_size=1131, ...}) = 0
fstat64(32, {st_mode=S_IFREG|0644, st_size=1131, ...}) = 0
read(32, "<\270d\30\312\357\234\225\315!\34\277`\241\275\335", 16) = 16
mmap2(NULL, 1131, PROT_READ, MAP_PRIVATE, 32, 0) = 0xae3e7000
close(32)                               = 0
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
futex(0xb48064f4, FUTEX_WAKE_PRIVATE, 1) = 0
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu_HU.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu_HU", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu_hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu_hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm", R_OK) = 0
stat64("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm", {st_mode=S_IFREG|0644, st_size=1101, ...}) = 0
open("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 42

It is quite weird the method how it looks for the qm files, but as you can see it loads all the qm files, and the last one (in my case the Swedish) is got used.

Transfer engine locization localisation problem

I have created a transfer engine plugin for the Sailfish OS, and I am facing difficulties with the localisation.

Problem: From the localisation folder always the last qm file got loaded regardless to the system locale

The example suggest that the translations shall be installed to the /usr/share/translations/nemotransferengine https://git.merproject.org/mer-core/transfer-engine/blob/master/example/example.pro#L48

My plugin called smsshareplugin, so I have installed smsshareplugin-hu, pl, sv.qm files to there.

But the loaded plugin ignores the system locale and always loads the last translation in the folder. I know only one similar plugin (with translation) the QR share, and it seems that they were in the same boot back in the 2015: https://github.com/Acce0ss/harbour-qr-share-plugin/issues/1#issuecomment-77699490

In the source code of the open source transfer plugin I have not found any relevant reference to the QTranslator, so I assume the problem is in some other layers.

By looking at the strace when the share is selected in the jolla-notes for e.g. very strange things got loaded (my locale is hu_HU.utf-8 but the situation is the same with other locales):

access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu_HU.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu_HU", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu_hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu_hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm-", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm", R_OK) = 0
stat64("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm", {st_mode=S_IFREG|0644, st_size=1068, ...}) = 0
open("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-hu.qm", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 42
fcntl64(42, F_SETFD, FD_CLOEXEC)        = 0
fstat64(42, {st_mode=S_IFREG|0644, st_size=1068, ...}) = 0
fstat64(42, {st_mode=S_IFREG|0644, st_size=1068, ...}) = 0
read(42, "<\270d\30\312\357\234\225\315!\34\277`\241\275\335", 16) = 16
mmap2(NULL, 1068, PROT_READ, MAP_PRIVATE, 42, 0) = 0xae3ea000
close(42)                               = 0
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu_HU.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu_HU", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu_hu.qm", R_OK) = -1 ENOENT (No such file or directory)
futex(0xb48064f4, FUTEX_WAKE_PRIVATE, 1) = 0
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu_hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm-", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm", R_OK) = 0
stat64("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm", {st_mode=S_IFREG|0644, st_size=1131, ...}) = 0
open("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-pl.qm", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 32
fcntl64(32, F_SETFD, FD_CLOEXEC)        = 0
fstat64(32, {st_mode=S_IFREG|0644, st_size=1131, ...}) = 0
fstat64(32, {st_mode=S_IFREG|0644, st_size=1131, ...}) = 0
read(32, "<\270d\30\312\357\234\225\315!\34\277`\241\275\335", 16) = 16
mmap2(NULL, 1131, PROT_READ, MAP_PRIVATE, 32, 0) = 0xae3e7000
close(32)                               = 0
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8
futex(0xb48064f4, FUTEX_WAKE_PRIVATE, 1) = 0
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu_HU.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu_HU", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu_hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu_hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu.qm", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-hu", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm-", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm", R_OK) = 0
stat64("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm", {st_mode=S_IFREG|0644, st_size=1101, ...}) = 0
open("/usr/share/translations/nemotransferengine/harbour_sms_share_plugin-sv.qm", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 42

It is quite weird the method how it looks for the qm files, but as you can see it loads all the qm files, and the last one (in my case the Swedish) is got used.