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

Localization

asked 2015-10-02 21:52:26 +0300

joonne gravatar image

updated 2015-10-02 21:53:37 +0300

Hi, I am trying to get translations working for my app and I have .ts and .qm generated for finnish language. I tried by some instructions and listed the files to .pro file like this:

translations.path = /usr/share/harbour-sailseries/translations

translations.files = ../translations/harbour-sailseries_fi.qm

INSTALLS += translations

But the SDK tells me this error during the build / rpm creation:

error: Installed (but unpackaged) file(s) found

Should I also define these files in some other file (spec/yaml?) to get them into rpm packet?

Also I tested that the translations are working when I copied them to /home/nemo/translations and used them from there in the app.

Thanks in advance for help :)

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-10-03 13:05:42 +0300

r0kk3rz gravatar image

updated 2015-10-03 13:08:27 +0300

Is this a Sailfishapp? If so, then this is what you need

CONFIG += sailfishapp_i18n
OTHER_FILES += translations/*.ts
TRANSLATIONS += translations/*.ts

Also, if you're debugging on device from QTC it will always display 'language C' and not what the device is actually set to. So to test you need to run on device launched from app grid.

edit flag offensive delete publish link more

Comments

Hi, thanks for answer. I still did not get it to work but maybe I am a bit confused since there are now (at least) 3 ways people have done this or I think so.

Did you mean that what you said above is all I need to get the translations working? Or do I still need the INSTALLS += definitions that I have? And the QTranslator part to my main.cpp file?

This is a stupid problem since I already got the translations working when I used them from the /home/nemo/translations folder which I created manually to the phone... :D

joonne ( 2015-10-04 22:54:27 +0300 )edit

Above is all you need.

nothing special in INSTALLS, nothing in main.cpp, its all handled automagically from the sailfishapp.

This is assuming all your translations are in a folder called 'translations' in your project folder.

r0kk3rz ( 2015-10-04 23:53:30 +0300 )edit

Hi again, the problem still exists. Now I looked from the compile output window and it says this:

Scanning directory '/home/mersdk/share/Documents/GitHub/harbour-sailseries/src/qml'... Updating '../../harbour-sailseries/src/translations/harbour-sailseries.ts'... Found 56 source text(s) (56 new and 0 already existing) Cannot create /home/mersdk/share/Documents/GitHub/harbour-sailseries/src/translations/harbour-sailseries.ts: No such file or directory lrelease error: Cannot open /home/mersdk/share/Documents/GitHub/build-harbour-sailseries-MerSDK_SailfishOS_armv7hl-Debug/src/../translations/harbour-sailseries-fi.ts: No such file or directory install -m 644 -p /home/mersdk/share/Documents/GitHub/build-harbour-sailseries-MerSDK_SailfishOS_armv7hl-Debug/translations/harbour-sailseries-fi.qm /home/deploy/installroot/usr/share/harbour-sailseries/translations/ install: cannot stat /home/mersdk/share/Documents/GitHub/build-harbour-sailseries-MerSDK_SailfishOS_armv7hl-Debug/translations/harbour-sailseries-fi.qm': No such file or directory make[1]: [install_qm] Error 1 (ignored) install -m 644 -p /home/mersdk/share/Documents/GitHub/build-harbour-sailseries-MerSDK_SailfishOS_armv7hl-Debug/translations/harbour-sailseries-fr.qm /home/deploy/installroot/usr/share/harbour-sailseries/translations/ install: cannot stat/home/mersdk/share/Documents/GitHub/build-harbour-sailseries-MerSDK_SailfishOS_armv7hl-Debug/translations/harbour-sailseries-fr.qm': No such file or directory make[1]: [install_qm] Error 1 (ignored)

So it seems that it finds the qml files correctly and the lupdate succeedes because it generates new files if I add for example harbour-sailseries-fr.ts to .pro file. This doesn't seem like a easy task for me at all.. :D

joonne ( 2015-10-05 22:43:54 +0300 )edit

check your paths, is your translatons directory in your src directory? because it looks like a mistake

 /home/mersdk/share/Documents/GitHub/harbour-sailseries/src/translations/harbour-sailseries.ts
r0kk3rz ( 2015-10-05 22:58:51 +0300 )edit

Hi, thank you so much for help, now it it working. :) The mistake was that I have the src and tests subprojects and I had the TRANSLATIONS definition in the src.pro file. SDK could'nt handle this althought I had the paths "correctly" written or something like that. This is great! :)

joonne ( 2015-10-05 23:16:10 +0300 )edit
Login/Signup to Answer

Question tools

Follow
1 follower

Stats

Asked: 2015-10-02 21:52:26 +0300

Seen: 316 times

Last updated: Oct 03 '15