AnsweredAssumed Answered

Test language/locale change in app

Question asked by paul.haakma on Jun 29, 2018
Latest reply on Jun 29, 2018 by paul.haakma

I've been looking at the Internationalization sample in AppStudio. I think I've figured out what to do and how the translation files work, and found the Qt Linguist menu items in Qt Creator for lupdate and lrelease etc.


Once thing I can't figure out is whether it is possible to switch the actual locale that an app is using, whilst the app is running?


The sample app demonstrates clicking different languages in a list and seeing some dates change to display in that locale. But the actual text of the app remains in English - i.e. the locale of my PC.


qsTr("This sample demonstrates internationalization of a qml app. All instructional text is retrieved from translations files.")


Is there some way I can hook up buttons to switch the locale of the actual app, so I can see the effects of a different locale? My thinking is along the line of: the translation files come back from translators, and I might want to test/view what it would look like in each locale.


Obviously I could switch the locale of my Windows OS or mobile device, but that seems a bit extreme! I remember accidentally switching a phone to another language once and it took me ages to figure out how to get it back into English!