| Prev |   1   2 |
maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   [Announce] Kids mode (https://talk.maemo.org/showthread.php?t=100313)

anig 2018-05-18 06:39

Re: [Announce] Kids mode
 
Quote:

Originally Posted by Zeta (Post 1544233)
I took a look at your code and discovered the qsTrId() function you used.

I usually use qsTr(), where you put for example directly the english text, and then it search for translations and if there is none then fallback to this english text.

But qsTrId() is different in that it works with an id to the translated text. I can see how that could be more efficient depending on the magic they put behind the qsTr() function, but means you must somehow define a default language as a fallback.
That is not too difficult from C++ (see http://doc.qt.io/archives/qt-4.8/qtr...or.html#load-2), as the "load" function returns a boolean to tell if the locale was correctly found or not, and then loading the english could be done.
For the translations, the QLocal class provides uiLanguages (the http://doc.qt.io/archives/qt-4.8/qlo...ml#uiLanguages) function which "returns an ordered list of locale names for translation purposes in preference order". There may be a way to add the english language as a low rank choice in there...

Finally, back to the load() function from QTranslator that must be used under the hood in the QML launcher, we see the logic for finding the translations files:

So maybe renaming/symlinking/copying the english translation file as "kids-mode.ts" should be enough. I see this file is already there in your repo, but with "<translation type="unfinished"></translation>" everywhere, which I suppose would not be displayed.

Thanks as per the sourcecode of sailfish the load function is used. https://github.com/sailfishos/libsai...shapp_priv.cpp
So in theory it should work. However it doesn't in practice. In the end I removed the language tag in kids-mode.ts and left everything untranslated. I then genereated the qm using:
lrelease -idbased -markuntranslated "" kids-mode.ts


Finally in the spec file I check the locale and if the translation file doesn't exist then I create the symlink.

Thanks for the advice.

anig 2018-06-29 05:31

Re: [Announce] Kids mode
 
New strings ready for translating on transifex.
https://www.transifex.com/x-39/kids-...ish/dashboard/

meloferz 2018-07-05 14:36

Re: [Announce] Kids mode
 
Quote:

Originally Posted by anig (Post 1545887)
New strings ready for translating on transifex.
https://www.transifex.com/x-39/kids-...ish/dashboard/

Hi, I'm the translator for Spanish, I don't understand the context of this string "On entering kids mode", could you please let me know when for example is shown this?

anig 2018-07-05 17:14

Re: [Announce] Kids mode
 
1 Attachment(s)
Quote:

Originally Posted by meloferz (Post 1546028)
Hi, I'm the translator for Spanish, I don't understand the context of this string "On entering kids mode", could you please let me know when for example is shown this?

It is in relation to what happens to running applications when you enter kids mode. You can choose to close them or hide them.


| Prev |   1   2 |
All times are GMT. The time now is 13:05.

vBulletin® Version 3.8.8