10
<string name="message">هذا المجلد يحتويى على %1$s ملفات. الرجاء التأكد قبل الحذف. الملفات المحذوفة غير قابلة للإسترجاع.</string>

I wanna put "%1$s" in an arabic string, but as you can see here, word, notepad++, utraedit, all failed to get the right string. how you guys edit arabic string?

thecr0w
  • 2,148
  • 4
  • 33
  • 59

4 Answers4

6

In android Studio 2, RTL support is not turned on by default, Configure it Manually:

1. In your Computer, go to the [android-studio2.0]/bins/idea.properties

2. add editor.new.rendering=true to the end of idea.properties

3. restart your android studio.

Gupta
  • 8,882
  • 4
  • 49
  • 59
HDL
  • 76
  • 1
  • 3
4

This is a source of frustration when editing mixed-direction text. What counts is the logical order of the text, not how any of the editors display it. When you finally format the string at run time in the app, the %1$s will be replaced by whatever string you pass to the formatting method. The only thing that matters is how the string will be rendered after the substitution.

The easiest thing to do is to write the message without the %1$s, then position the insertion caret, paste in the format code, and simply ignore how the editors screw up the bidi analysis. (The screw-up is because the editors are using a left-to-right base level. In some editors, you can set the base flow to right-to-left, but then the xml markup ends up being unreadable.)

Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
2

When I work with RTL text and I need to put a place holder(%1$s) or LTR words, I just write it in MS Word and copy to the IDE.
It works for me in Eclipse and Android Studio.
All you need to check is that the components that displays that string like TextView has the right gravity.

NickF
  • 5,637
  • 12
  • 44
  • 75
  • 1
    Android studio really needs to improve, the typing, highlighting, positioning the cursor in arabic text is all messed up. The preview doesnt even connect the letters properly even though something basic such as notepad can... VS ide handles this much much better so its definately possible. – sprocket12 Nov 05 '13 at 19:00
  • @لَاإِلٰهَإِلَّاالله : is it possible to read arabic language in android studio ? Which encoding version have to use for android studio ? – Anand Savjani Sep 01 '15 at 05:43
1

You can try in Activity..

String formatedString =  String.format("%1$s", getString(R.string.your_string));
Vishesh Chandra
  • 6,951
  • 6
  • 35
  • 38