You should have a LocaleHandler object in your application and listen to the systemLanguageChanged() signal.
This signal will be called anytime the user changes the language through the settings menu.
When this happens you should update your installed dictionary to the new one with something like the below code:
void MyAppSettings::updateLanguage() {
QString translations = QString("MyApp%1.qm").arg(QLocale().name());
Application::instance()->removeTranslator(&mTranslator);
if (mTranslator.load(translations, "app/native/qm")) {
qDebug() << "LOAD FINISHED";
Application::instance()->installTranslator(&mTranslator);
} else {
qDebug() << "COULD NOT INSTALL TRANSLATIONS " << translations;
}
}
This will remove the current dictionary and replace it with the new one for the chosen system language.
Unfortunately this is not enough, as it will not update any existing screens you have for your app. To update existing strings in QML you should add Retranslate.onLanguageChanged to your translated string.
ex:
Label {
text: qsTrId("header1") + Retranslate.onLanguageChanged
}
This will update the string for the above lavel every time the translator changes. For more information see: http://developer.blackberry.com/cascades/reference/bb_cascades_qmlretranslate.html