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

Transfer engine localisation problem [duplicate]

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

updated 2018-11-18 12:35:02 +0200

Spam Hunter gravatar image

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.

edit retag flag offensive reopen delete

The question has been closed for the following reason "duplicate question" by raketti
close date 2018-11-21 13:40:25.060372

Comments

I can't see any subdirectories under /usr/share/translations/ (except the irrelevant source). All *.qm files are placed directly under translations folder e.g. /usr/share/translations/nemo-transfer-engine-*.qm Could you try to continue using that flat tree approach to see if it works (i.e. without the additional subdirectory)?

sledges ( 2018-11-29 11:27:50 +0200 )edit

@sledges

My plugin installs the qm files to the /usr/share/translations/nemo-transfer-engine/harbour_sms_share_plugin-{pl,hu,sv}.qm path:

https://imgur.com/a/POFIZ7q

I shall install them to /usr/share/translations/nemo-transfer-engine-sms-share-{pl,sv,hu}.qm?

Pekka submitted an MR on the transfer plugin example: https://git.merproject.org/mer-core/transfer-engine/merge_requests/8/diffs#5b5a10cb9d21853528950d7939e5fea590075a47_54_61

but it still installs to subfolder.

martonmiklos ( 2018-11-29 23:04:40 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2018-11-21 12:40:48 +0200

Duplicate of this: https://together.jolla.com/question/87311/bug-transfer-engine-plugin-translations-not-loaded-correctly/

From 2015...

edit flag offensive delete publish link more

Question tools

Follow
3 followers

Stats

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

Seen: 168 times

Last updated: Nov 21 '18