Skip to main content

QtWS15- Lightning Talk, Declarative Retranslations in QML, Vladimir Moolle, ICS

Qt World Summit 2015, OCTOBER 5-7, BERLIN, GERMANY Declarative Retranslations in QML: Have you seen QML code flipping a (never read on the other side) flag, just to force a tr() call to happen in C++? Or an empty string property, appended to all translated QML strings and pretending to change, merely to force expression reevaluation (which is not guaranteed to happen, strictly)? Or a retranslateUi() Javascript function traversing text properties in the scene on UI language change? This talk suggests a cleaner (and more “declarative”) alternative, lacking the drawbacks of above approaches. Additionally, some generalizing observations are made (i.e. what if what you are dealing with is not a string-in-string-out function, that relies on some hidden state, but rather a more complex query whose context may change with time?). A small self-contained example will be provided. Video by Qt Company and greenwoodworx, www.greenwoodworx.com