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
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

support different languages on blackberry 10

Hello,

 

on iOS programming I think you have concept of String tables. You can have separate tables for different languages (e.g., English, German, etc.). inside it you have keywords like this:

 

"goodMorning" = "Good Morning!"

 

in the string table for german you might have same key as:

 

"goodMorning" = "Guten Morgen!"

 

then in app I think you can directly use "goodMorning" keyword and depending on the language correct value will be displayed (e.g., either Good Morning or Guten Morgen).

Is there anything similar in Balckberry 10?? I think it should be?? If yes, what... any links/references.. thanks..

 

 

Please use plain text.
Developer
dishooom
Posts: 103
Registered: ‎12-31-2012
My Device: Blackberry 9810
My Carrier: Verizon

Re: support different languages on blackberry 10

Yes, there is something very similar...

Its technically called Internationalization Support

 

http://developer.blackberry.com/cascades/documentation/device_platform/internationalization/

Please use plain text.
Developer
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: support different languages on blackberry 10

I noticed that link before, but I thought it was mainly talking about different Times etc. i think i missed somewhere it talking about similar keywords to what I mentioned above .. ?!
Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: support different languages on blackberry 10

Hi,

 

At that link above there's a subpage on translation:

http://developer.blackberry.com/cascades/documentation/device_platform/internationalization/localiza...

 

Also this threads contains some helpful information:

http://supportforums.blackberry.com/t5/Cascades-Development/Translations-example/m-p/2088859#M11050

 

Some Qt docs, but they contain mostly the same info:

http://developer.blackberry.com/cascades/reference/i18n-source-translation.html

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: support different languages on blackberry 10

looks like it.

you use the Qt approach to localization, which is quite simple and convinient.
Basically you download QtLinguist and open the ts file with it, i found that self-explainatory.
For the basics you should study the link dishooom has posted.
----------------------------------------------------------
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.
Developer
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: support different languages on blackberry 10

[ Edited ]

Hi, thanks for the links they have some info.

 

But I am still looking for a step by step guide (for beginners maybe?)...

 

 ps. also it seems I don't have lupdate tool on my Mac; I get this error: -bash: lupdate: command not found; where to download it from?? thanks,

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: support different languages on blackberry 10

lupdate is integrated into momentics and runs automatically when you compile your project.
----------------------------------------------------------
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.
Developer
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: support different languages on blackberry 10

How can I create the .ts files then???

Ps. I also could not find translation folder and the name of .qm file in the bar-descriptor .xml file as mentioned here: http://developer.blackberry.com/cascades/documentation/device_platform/internationalization/localiza...
Please use plain text.
Contributor
CrystalBullet
Posts: 19
Registered: ‎02-14-2013
My Device: Red Z10
My Carrier: WIND Mobile

Re: support different languages on blackberry 10

For the .ts files to be generated, you need to specify the languages you want in your .pro file, for example, at the end of the file, put:

 

TRANSLATIONS = \

    $${TARGET}_en_GB.ts \

    $${TARGET}_fr.ts \

    $${TARGET}_it.ts \    

    $${TARGET}_de.ts \

    $${TARGET}_es.ts \

    $${TARGET}.ts

 

Not all project templates include that by default from what I have seen.

 

Then in QML, wrap all strings into: 

title: qsTr("My Title")

 

And in C++ use tr(), as:

label->setText(tr("My Lable"));

 

When you build, the .ts files will be updated with all the wrapped strings in your app.

 

You can also have variable that handle the language specific word order using arg() as:

 

qsTr("%L1y ago").arg(interval);

 

Then you can translate in French for example in the .ts file using:

 

    <message>

        <source>%L1y ago</source>

        <translation>il y a %L1 ans</translation>

    </message>

 

 

 

--
Martin Larochelle
Macadamian
http://bb10ize.me
Please use plain text.
Developer
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: support different languages on blackberry 10

Hi Thanks it seems I had already added following values to the .pro file:

 

 TRANSLATIONS = MyProgram_en.ts \
                MyProgram_de.ts

 

and also now I see a folder named "translations" and it contains 8 files:

 

  • Makefile
  • MyProgram_de.qm
  • MyProgram_de.ts
  • MyProgram_en.qm
  • MyProgram_en.ts
  • MyProgram.pro
  • MyProgram.ts


I have also used the tr() keyword at several places in my app but the .ts files seem to look empty, like this:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="en_US">
</TS>

 Can you please help? What I maybe doing wrong? Thanks.

 

Please use plain text.