Skip to content

Trigger binding reevaluation on language change

Volker Krause requested to merge work/vkrause/qml-runtime-retranslate into master

This enables QML applications using KI18n to change their language at runtime.

To support this we just need a call to QQmlEngine's markCurrentFunctionAsTranslationBinding() from within each i18n() function, and to listen to the language change event.

This however adds a Qt::Qml dependency to KLocalizedContext. That in itself is fine, KLocalizedContext is unusable without that anyway. However, we can't have that in KF::I18n, so we need a new library and the full copy&deprecate dance.

Depends on Qt 6.6 API, on older versions there is no change to the current behavior.

While at it, also add a convenience method for setting this up on the application side which does the engine/context association correctly.

Related changes:

Merge request reports

Loading