There's a Qt/QML app that uses qsTr()
for localizing it's strings in .qml
files and a Qt plugin (loaded via QPluginLoader
) that does the same.
Text { text: qsTr("back") }
Suppose there's a same string that in app has one meaning and in the plugin it has another meaning. Both strings used in the same context (like a component MyWindow.qml
)
// plugin: "back" -> go back
// app: "back" -> not front
When we install different QTranslator
into the app, they are looked up in the reverse order which means either app translation gets overwritten by plugin OR plugin translation gets overwritten by app (not to mention when 2 plugins can overwrite one another).
QCoreApplication::instance()->installTranslator(appTranslator);
QCoreApplication::instance()->installTranslator(pluginTranslator);
How to break this loop so in app it uses app translation and in plugin it uses plugin's translation?