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

Java Development

Reply
Developer
Posts: 36
Registered: ‎11-19-2008
My Device: Blackberry 9000 - Bold
Accepted Solution

Creating an Arabic Resource File

I am localizing my app and have successfully integrated 3 different languages.  I want to create an Arabic .rrc file for my App.  A friend of mine created the .rrc file and sent it across.  Eclipse, however, does not seem to like it when I load it into the project.  I receive errors like "Integer required at line x:yy" or "Expected '#' near"

 

Does the Arabic .rrc file have to be in a specific format?  At the moment, it looks like a standard key/value pair file, viz.

 

FIELD_ALL#0="arabictext [right to left]"; 

FIELD_YOUR#0="arabictext [right to left]";

FIELD_BASE#0="arabictext [right to left]";

 

I played around with the encoding of the file changing it from US-ASCII, ISO-8859-1, Cp1252, UTF8, UTF16, etc within Eclipse, but still no dice.

 

I am using Eclipse JDE 1.1.2.201004161203-16.  I have attached an excerpt from the .rrc file if anyone wishes to take a look.

Chirashi Security
Developer
Posts: 16,687
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Creating an Arabic Resource File

the rrc files are in ANSI format, the characters have to encoded using unicode.

here an example from my chinese language file:

LICENSE_ACCEPT#0="\u63A5\u53D7";

i would suggest you create your language file empty in the jde/eJDE and use copy+paste to fill it with the arabian words.

----------------------------------------------------------
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
Developer
Posts: 36
Registered: ‎11-19-2008
My Device: Blackberry 9000 - Bold

Re: Creating an Arabic Resource File

Thanks for your answer.

 

Painfully this is the approach I will have to take.  The only problem is that when I paste my Arabic text into Eclipse, the text is backwards.  I don't know if I need to enable a right to left option in Eclipse or something.  If it can't be done, then I guess I'm looking at writing a Python script to reverse the text.

Chirashi Security
Developer
Posts: 16,687
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Creating an Arabic Resource File

i used the tool prbeditor to edit resource files, together with a few search&replace routines in notepad++.

never used any arabic (or other right to left) language files, maybe you can post your findings, i am sure somebody will appreciate them when they come to a similar problem.

----------------------------------------------------------
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
Developer
Posts: 36
Registered: ‎11-19-2008
My Device: Blackberry 9000 - Bold

Re: Creating an Arabic Resource File

I ended up writing a Python script to reverse the Arabic letters.  This takes care of the problem of the file not being imported into Eclipse correctly and having mixed left-to-right and right-to-left text in one file.  You can find the code below, in case someone wants to use it.  One caveat, if you have links or words in English, they get reversed also.  Please check your output first.  In my case, I had minimal English words, so I was okay.  You need to have Python installed on your computer to use this script.  Windows users can get Python from here.  Mac/Linux users should already have it installed.  Save the code below as a file called ar_reverse.py.

 

Run the script from the command line as follows (assuming your Arabic Resource file is called AYBResource_ar.rrc)

 

Windows:  type AYBResource_ar.rrc | python ar_reverse.py > AYBResourceR_ar.rrc

Mac/Linux: cat AYBResource_ar.rrc | python ar_reverse.py > AYBResourceR_ar.rrc

 

Then just swap the names of AYBResource_ar.rrc and AYBResourceR_ar.rrc 

 

I was then able to import the file directly into Eclipse.

 

Code is below (Please note that indents are required for Python):

 

 

#!/usr/bin/env python

import sys

for line in sys.stdin:
	w = line.rsplit('"')
	q = w[1].decode('utf-8')[::-1]
	s = w[0] + '"' + repr(q).split("'")[1] + '"' + w[2].strip()
	print s

 

 

 

Chirashi Security
Contributor
Posts: 48
Registered: ‎03-04-2009
My Device: Not Specified

Re: Creating an Arabic Resource File

i have try to set "Gujarati" unicode value on resource file, it display proper on resource file but not display on blackberry device. have any idea.