Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone
Accepted Solution

qsTr not working in all qml files

any Idea ?

 

in one of my apps translation inside QML using qsTr("my text") only works in main.qml -

all the other qsTr(...) is ignored.

 

but this doesn't happen always - in other Apps it works

 

thx for any hints

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: qsTr not working in all qml files

Make sure that you update the .pro file to include the directories that the other qml files are in. By default it only includes the root /assets directory

Like all of my posts
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: qsTr not working in all qml files

thx Kyle.

 

adding this manually fixes the problem

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Contributor
Posts: 15
Registered: ‎11-01-2012
My Device: Blackberry 10
My Carrier: RIM

Re: qsTr not working in all qml files

[ Edited ]

assets\main.qml

assets\another.qml

 

qsTr works well in main.qml

 

but when the navigationPane in main.qml navigates to another.qml, the qsTr() does not work in the another.qml page.

 

 

any method to fix the problem?

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: qsTr not working in all qml files

please create your own thread, you can link to other threads if you think they are related.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
Posts: 13
Registered: ‎01-08-2013
My Device: Dev Alpha
My Carrier: Dev Alpha

Re: qsTr not working in all qml files

Hey,

 

could you please show me the syntax to add this files to the .pro?

 

I tried "include(assets/pages)", "include(assets/pages/)" and "include(assets/pages/*.qml)" but nothing works.

Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: qsTr not working in all qml files

include(config.pri)

lupdate_inclusion {
    SOURCES += \
        $$BASEDIR/../assets/dispatch/*.qml
        $$BASEDIR/../assets/orders/*.qml
        $$BASEDIR/../assets/common/*.qml
        $$BASEDIR/../assets/maps/*.qml
}

 here it is

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Contributor
Posts: 13
Registered: ‎01-08-2013
My Device: Dev Alpha
My Carrier: Dev Alpha

Re: qsTr not working in all qml files

Thank you ekke!