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
Developer
ekke
Posts: 1,476
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
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
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
kylefowler
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
Please use plain text.
Developer
ekke
Posts: 1,476
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
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
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Contributor
mindon
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?

Please use plain text.
Developer
simon_hain
Posts: 16,044
Registered: ‎07-29-2008
My Device: Z10 LE
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
Please use plain text.
Contributor
torsten_ktz
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.

Please use plain text.
Developer
ekke
Posts: 1,476
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
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
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Contributor
torsten_ktz
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!
Please use plain text.