Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.2, 5.2.0 RC1
-
None
-
qtdeclarative/stable: 4d3a654dddbb648be97fe52c695601f6864f72a1
Description
I am trying to translate some strings from a .js library imported by my QMLs, the strings are found by lupdate but when I launch my app the qsTr function cannot find the translated string but it works with the strings in the QML files.
Javascript “file.js”
function func() { var temp = qsTr("TEST") return temp }
QML
import "file.js" as JSLIB Text{ text: JSLIB.func() }
I have add some logs in qsTr() function in qtdeclarative/src/qml/qml/v8/qqmlbuiltinfunctions_p.h. The problem is qsTr() is looking the tag in a context with the file basename less the last character for .js files. I have modified manually the .ts file and it works:
Old .ts generated by lupdate (NO WORKING):
... <context> <name>file</name> ...
New .ts modified manually (WORKING):
... <context> <name>fil</name> ...