Translate model c++
-
Hi, I am trying to translate a model in c ++ with tr () QLinguist, .ts, etc; but it doesn't translate.
The elements of qml with qsTr () do translated but the c ++ elements with tr () or with any other macro to mark for translation, it did not work.QLinguist detects the Qstring between tr () but when I load the .qm once translated with the QLinguist, it does not produce the change, you only change those of the qml with qsTr () but those of the c ++ model do not. The data is loaded into a ListView and created with a delegate that takes the values of the c ++ model
-
Hi, I am trying to translate a model in c ++ with tr () QLinguist, .ts, etc; but it doesn't translate.
The elements of qml with qsTr () do translated but the c ++ elements with tr () or with any other macro to mark for translation, it did not work.QLinguist detects the Qstring between tr () but when I load the .qm once translated with the QLinguist, it does not produce the change, you only change those of the qml with qsTr () but those of the c ++ model do not. The data is loaded into a ListView and created with a delegate that takes the values of the c ++ model
-
Hi, I am trying to translate a model in c ++ with tr () QLinguist, .ts, etc; but it doesn't translate.
The elements of qml with qsTr () do translated but the c ++ elements with tr () or with any other macro to mark for translation, it did not work.QLinguist detects the Qstring between tr () but when I load the .qm once translated with the QLinguist, it does not produce the change, you only change those of the qml with qsTr () but those of the c ++ model do not. The data is loaded into a ListView and created with a delegate that takes the values of the c ++ model
-
Hi, I am trying to translate a model in c ++ with tr () QLinguist, .ts, etc; but it doesn't translate.
The elements of qml with qsTr () do translated but the c ++ elements with tr () or with any other macro to mark for translation, it did not work.QLinguist detects the Qstring between tr () but when I load the .qm once translated with the QLinguist, it does not produce the change, you only change those of the qml with qsTr () but those of the c ++ model do not. The data is loaded into a ListView and created with a delegate that takes the values of the c ++ model
the QML engine does an expensive reevaluation of all bindings/assignments when the language changes, so you do not have to do much, to see the new strings.
On the c++ side of things its a but more complicated. Like @mzimmers said, I have no idea how your code is structured, and how you pass the model to QML.
Changes are high, that your model is loaded in memory in the beginning of the app, and not reconstructed/reloaded when the language changed -> therefore old string will still be present
-
thanks to both of you. In the end I decided to use files to save the translations without using the QLinguist. Thanks for answering me :)
@Fian said in Translate model c++:
I decided to use files
It looks like your issue is solved. If so, please don't forget to mark your post as solved!