[Interest] qsTr/qsTrId dynamic binding support

Thomas Senyk thomas.senyk at pelagicore.com
Wed Aug 14 11:42:19 CEST 2013


On Monday, 12 August, 2013 9:20:57 CHRISTOPHER COURTOIS wrote:
> Hi,
> 
> Is there a plan to support dynamic binding in qml for translations functions
> ?
> 
> "dynamic" because bindings to qsTr never reevaluates on language switch.
> 
> As of today I use the workaround proposed here :
> http://qt-project.org/wiki/How_to_do_dynamic_translation_in_QML
> 
> But It looks really hacky to me to do something like this in qml :
> 
> --
> 
> Text  {
>     text: qsTr("Hello") + autoTr
> }


+1
It's a hack not a solution.

I guess changing qsTr is not a solution, so the proper solution might be to 
introduce a new function like:
 function bindTr(string)
which would be reevaluated after the language-change-event.
... although I got no clue how to do something like that properly.

> 
> --
> 
> 
> Cheers,
> 
> Christopher



More information about the Interest mailing list