05-17-2010 04:36 AM
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 18.104.22.168004161203-16. I have attached an excerpt from the .rrc file if anyone wishes to take a look.
Solved! Go to Solution.
05-17-2010 04:49 AM
the rrc files are in ANSI format, the characters have to encoded using unicode.
here an example from my chinese language file:
i would suggest you create your language file empty in the jde/eJDE and use copy+paste to fill it with the arabian words.
05-17-2010 04:59 AM
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.
05-17-2010 05:03 AM
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.
05-17-2010 10:23 PM
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.decode('utf-8')[::-1] s = w + '"' + repr(q).split("'") + '"' + w.strip() print s