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
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: East Asian languages not working on Dev Alpha B?

Try replacing one of tr-s with hardcoded string to see if it's tr()'s issue.

Then compare the string you're getting from tr() with hardcoded string to see how they mismatch.

Just guessing, but this also might be XML loading issue, does the XML have <?xml version="1.0" encoding="utf-8" ?> at the beginning?

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: East Asian languages not working on Dev Alpha B?

does the XML have <?xml version="1.0" encoding="utf-8" ?> at the beginning?

 Yes.

Try replacing one of tr-s with hardcoded string to see if it's tr()'s issue.

 I did, with this line:

m_label = Label::create(QString::fromUtf8("检查字体"));
and
m_label = Label::create("检查字体");

 But when I try to save, it gives me an error:

Save could no be completed. Try File > Save As...if the problem persists.

Reason:
Some characters cannot be mapped using 'MacRoman' character encoding.
Either change the encoding or remove the characters which are not supported by the MacRoman character encoding.

 Are my project files in the wrong format?

 

It does give the option to "Save as UTF-8" but I don't want to try it for fear it will break the project. Smiley Happy

 

 

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: East Asian languages not working on Dev Alpha B?

[ Edited ]

Yes, the encoding seems to be different. You'll need the source file in UTF8 encoding to declare this string. (I'm talking only about the constant here, variables shouldn't depend on this)

You can create another cpp file in utf8 and define the string there:
For example, in test.cpp:

#include <QString>
QString testString = QString::fromUtf8("...");

then in your actual .cpp file:

extern QString testString;
// and use testString

Backing up the entire project before experimenting with encodings would be a good idea though. Smiley Happy


Andrey Fidrya, @zmeyc on twitter
Highlighted
Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: East Asian languages not working on Dev Alpha B?

[ Edited ]

So I did it like this:

 

I created a "test.hpp" file

Inside that:

#define TEST_STRING "检查字体"

Saved it as UTF-8

 

Then in the original cpp file, I imported the test.hpp and changed the lines below:

m_label = Label::create(QString::fromUtf8(TEST_STRING));
//and
//m_label = Label::create(TEST_STRING);

 Both lines showed the asian characters.

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: East Asian languages not working on Dev Alpha B?

Another guess: could you try setting a codec using codecForTr?

 

QTextCodec::setCodecForTr("UTF-8")

 

Or try using trUtf8() instead of tr().

 


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: East Asian languages not working on Dev Alpha B?

Arrrghhhh.

 

Tried them both, still not working

 

Smiley Sad

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

Re: East Asian languages not working on Dev Alpha B?


javoid wrote:.... But when I try to save, it gives me an error:
Save could no be completed. Try File > Save As...if the problem persists.

Reason:
Some characters cannot be mapped using 'MacRoman' character encoding.
Either change the encoding or remove the characters which are not supported by the MacRoman character encoding.

 Are my project files in the wrong format?

 


first thing I'm always doing for a new workspace on Mac is to change the encoding

encoding.png

-------------------------------------------------------------------------------
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: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: East Asian languages not working on Dev Alpha B?

I changed the workspace to UTF-8.

 

I then looked at the files for the languages and the cpp files, and they are now using the inherited workspace properties and are now UTF-8.

 

Cleaned and ran the project.

 

I'm still not getting any east asian languages imported from the ts files (even through the nav bar buttons and icon have the translations).

 

Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: East Asian languages not working on Dev Alpha B?

I made a separate test project.

 

English and French show, but asian languages do not.

 

See attached.

Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: East Asian languages not working on Dev Alpha B?

Noticed that ALL the examples on Github with localizations are only localized in a few European languages.  Not a single example with Asian characters.