7

I am working with an Arabic translator who is translating my strings.xml from english to arabic. I realize that only Honeycomb or Cyanogen roms will support arabic rendering, but that is ok.

Our problem is that the text keeps getting flipped around. It seems that some text editors (like Eclipse) blatantly do not support right-to-left text. And in some cases, the text is not flipped character by character, but word by word, or parts of the sentence get rearranged ... when copying from Microsoft Word back into the UTF-8 xml file.

For example, the translator supplied lines with spaces on each end, and naturally I wanted to clean these up. But doing so flipped some of the text around!

For example:
إغلاق التطبيق
became:
التطبيقإغلاق
just by removing spaces around the edges.

Questions:
1. What editor should I be using?
2. Is it ok to mix english and Arabic on the same line (such as the App Name or other words that should not be translated) or is this fundamentally a no-no?

Kate Gregory
  • 18,808
  • 8
  • 56
  • 85
swinefeaster
  • 2,525
  • 3
  • 30
  • 48
  • 5
    Not very polite to end a question addressed to the community with "Thanks! swine" :P – ShreevatsaR May 20 '11 at 05:24
  • Does it work so only with string.xml file? Did you try to read from assets file or from file on sdcard? (for test) – pleerock Nov 10 '12 at 02:58
  • I have never used it, but stumbled upon http://poeditor.com/ some time ago. The translator would enter the translation directly into the webapp and you can use the exported strings directly. Hope it helps. – dualed Nov 11 '12 at 01:57

5 Answers5

4

I am currently working on an Arabic/English project, and I speek both languages, so I can provide you with my experience :)

Answer to Question 1: Any editor that supports UTF8 will do. I am now using both eclipse and notepad++.

To setup eclipse with UTF8 (which is not the default for some reason), go to window menu -> preferences -> general -> workspace then change text file encoding from deault (cp1252) to other, and choose utf8, then restart eclipse.

For notepad++, ensure you install supported locales, including Arabic. It is not checked during instulation and you have to tick the checkbox to enable that feature.

Answer to Question 2: It is absolutely fine to mix Arabic and English words together in a sentence. A very very good article I found about that is written here http://www.w3.org/International/tutorials/bidi-xhtml/

This article describes design concepts for sites that support right-to-left languages (including Arabic and Hebrew), with emphasis on Arabic due to it being a more complex language because some letters get connected to others and some do not.

Even though this article is talking about website design, it has a good amount of how Arabic and English languages should be mixed.

Greeso
  • 7,544
  • 9
  • 51
  • 77
  • Thanks Wahab, would you be willing to work with me offline to get this working for Android? Then we can circle back and enlighten the stackoverflow community with our specific findings for android. – swinefeaster Nov 10 '12 at 07:38
  • Sure, this will benifit me as well because I am planning an Android release in future for my project (currently I am at website development stave). – Greeso Nov 10 '12 at 17:44
  • what is your email? you can email me at swinefeaster at gmail dot com. – swinefeaster Nov 11 '12 at 08:06
1

1- I developed few Android apps that support Arabic and I am using Notepad++ to edit the resources file without any problems. Just remember to select RTL from view menu (Ctrl+Alt+R).

Virtually all Android devices that support Unicode will display Arabic letters, but if bidi algorithm is not part of specific Android version you can use a custom library to connect letters and display Arabic correctly.

Here is a library that I used before

A Blog that describes how to use it

2- In general, I would not recommend mixing Arabic and English especially if it will involve special characters as it can be displayed awkwardly.

iTech
  • 18,192
  • 4
  • 57
  • 80
1

There a simple way to insert the right to left and left to right marks in any application under windows:

1- Right to left mark: ALT + 0254 from the right numeric pad in the keyboard 2- Left to Right mark: ALT + 0253 from the right numeric pad in the keyboard

Withouusing any special editors or macros, this can be used in any application, whether in Notepad, Word, HTML, XML... etc.

Hopefully, this would be helpful for everybody

Best regards Your Arabic Translation Team

0

I know the Eclipse part, the default font in Eclipse doesnt support Unicode, So change it to "Aria Unicode MS" font. To do this in Eclipse workspace click on Windows in Menu Bar -> Preferences -> General -> Appearance -> Colors and Fonts. Now in the file explorer like menu in right, expand Basic, select "Text Font" and click on Edit.. button.

Hope this solves your viewing issue with Eclipse.

About Arabic app name issue, think on this, if you do localization correctly, then the Arabic name for app will be displayed only when the user changes the handset locale (and thus language) to Arabic, otherwise the default English app name will be displayed. So, just set the Arabic name in Arabic string.xml and English in the English one and you should be good.

omermuhammed
  • 7,365
  • 4
  • 27
  • 40
  • I can see Arabic characters in eclipse, though they might be reversed character-by-character... I don't know it's actually hard to tell cause I'm not arabic! But definitely I can see unicode. – swinefeaster May 20 '11 at 05:28
  • 1
    Try copy pasting the translator's string in the xml file, then building the apk and asking someone who can speak Arabic to proof read it. If you cant find it, send it to someone on net after taking screenshots in emulator. – omermuhammed May 20 '11 at 05:35
0

As for editor part, there is no way to answer your question without knowing the platform. On Windows, standard Notepad should do.

For mixing strings, it is rather common scenario. It is typical that App Name won't get translated. Also, sometimes you need to put some English description in the brackets. You might need to play with strong directionality marks in such case (otherwise brackets would look a bit strange).

Paweł Dyda
  • 18,366
  • 7
  • 57
  • 79
  • I am developing for Android on Windows7. My problem is more about the handling of right-to-left and the weird things that happen when you mix strings; mixing any other left-to-right languages with english are a non-issue (even japanese, etc). – swinefeaster May 20 '11 at 07:10
  • I know of these issues and this the reason why I wrote about directionality marks. You have to somehow inform the parser which part is RTL and which LTR and you do that by placing Unicode directionality marks. – Paweł Dyda May 20 '11 at 08:05
  • Interesting, so what is the best way to insert these markers? Is there a text editor for windows that makes it easy to do so? I can't exactly ask the translator to edit the utf8 binary... – swinefeaster May 20 '11 at 20:04
  • I am afraid that the only way I know is to copy these marks from for example Character Map and paste them. It might be possible to automate such thing in say [Notepad++](http://notepad-plus-plus.org/download) which has macros and [plug-ins](http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Plugin_Central), although I don't know how good it is in handling BiDi... – Paweł Dyda May 21 '11 at 19:46