two questions regarding QML

Sebastian Kügler sebas at kde.org
Mon Mar 14 03:33:18 PDT 2016


Hi Dirk,

On Sunday, March 13, 2016 11:30:15 AM Dirk Hohndel wrote:
> I guess you are the most likely people who have a good answer here...
> 
> a) is there a simple, concise, useful introduction to localization of QML
> code? The way we do localization in Subsurface is a bit odd because of the
> large amount of C code that we have, but it fundamentally uses the tr()
> facility and then Transifex as a back-end for the translators to work with.
> How do we do this for QML code? I guess there's some magic macro or
> something? And does the lupdate / lrelease tooling correctly deal with
> those strings or do I need more magic to make this all work?

First, I know next to nothing about translations. For KDE apps, we use a 
different mechanism built with the ki18n Framework, and it's not compatible 
with Qt's tr() system.

I could quickly find this page: http://doc.qt.io/qt-5/qtquick-internationalization.html which suggests that it works the same way as lupdate 
/ lrelease.

> b) Thomas suggested that we should use the swipe right as our "back"
> function everywhere. Is there an easy way in QML / Kirigami to be told if
> there was a swipe right on the current page? I browsed the Kirigami sources
> and find a lot of painful, manual QML that seems to deal with the swipes
> for the overlay drawers, but I hope I don't have to reproduce something
> like that in my code... on most pages we actually happen to do the right
> thing already, the only one where this doesn't quite work is the StartPage
> (so when we re-enter cloud credentials). I could work around this by making
> the Dive List option in the menu do the right thing here and then I guess I
> could avoid handling all this, but I figured I'd at least ask in case this
> is easy...

We could fire a signals swipedRight(event) and swipedLeft(event) from the 
Kirigami components perhaps, and allow the user (of the components) to accept 
it (event is "eaten" by the app) or not accept it (event may be used by the 
app, but is still also handled in the component, for example to switch page.

Would that solve your problem? 
-- 
sebas

http://www.kde.org | http://vizZzion.org


More information about the subsurface mailing list