Test language/locale change in app

745
2
Jump to solution
06-29-2018 01:37 AM
PaulHaakma
Regular Contributor

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!

0 Kudos
1 Solution

Accepted Solutions
nakulmanocha
Esri Regular Contributor

Hi Paul,

We do provide a way to run your app in different locales within the AppStudio Desktop (AppRun).You need to launch your AppStudio using the command line. For e.g. if I need to launch my AppStudio desktop in arabic. I could do that using the command line

<installed location>AppStudio.exe --locale ar

Similarly, for German I would use AppStudio.exe --locale de

This way you can view how your apps run in the different locales without changing the system locales. This is very effective especially for windows

I hope this is what you are looking for.

Nakul

View solution in original post

0 Kudos
2 Replies
nakulmanocha
Esri Regular Contributor

Hi Paul,

We do provide a way to run your app in different locales within the AppStudio Desktop (AppRun).You need to launch your AppStudio using the command line. For e.g. if I need to launch my AppStudio desktop in arabic. I could do that using the command line

<installed location>AppStudio.exe --locale ar

Similarly, for German I would use AppStudio.exe --locale de

This way you can view how your apps run in the different locales without changing the system locales. This is very effective especially for windows

I hope this is what you are looking for.

Nakul

0 Kudos
PaulHaakma
Regular Contributor

Yes that's good enough for me - thanks.

0 Kudos