0

I have two projects

  1. Project1 contains a strings file with entry (values, values-ar) for Arabic and English accordingly.

  2. Project2 which include Project1 and must override the entry of strings file with Arabic text in both (values, values-ar)

When I put its value in arabic it doesn't show my text, but when I add English text it works

I have tried it many times and I don't know what the problem is, can anyone help please.

twlkyao
  • 14,302
  • 7
  • 27
  • 44
Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175

2 Answers2

0

Android chooses the right string file according to device's language.

Placing the Arabic Strings on files at rec/values-ar/ folder and setting device's language to "ar" will work.

ivan.aguirre
  • 500
  • 4
  • 11
  • but my requirement is to make the strings of Project2 all in Arabic no matter of device language, how can I do that ? – Amira Elsayed Ismail Jan 08 '14 at 16:04
  • I would highly recommend using the standard localization techniques and let Android mades its magic, that's what user expects and that's the correct approach. Anyway I you could "force" the device's Locale: http://stackoverflow.com/questions/17771531/android-how-to-get-string-in-specific-locale-without-changing-the-current-local?rq=1 But I don't believe it's a good idea either. – ivan.aguirre Jan 09 '14 at 15:00
  • Thanks a lot ivan.aguirre, I will give it a try and get back to you – Amira Elsayed Ismail Jan 09 '14 at 15:08
0

If project 2 is exclusively Arabic remove the values-ar and place all your Arabic text within the values folder.

Ensure that every string value in Project1's values is placed within Project2's values file in Arabic to override all English values.

CodeChimp
  • 4,745
  • 6
  • 45
  • 61
  • I have removed values-ar from Project2, but I don't want all strings from Project1 as Project one have some modules that are not included in Project2, so I have added only strings I want, but no thing happen, I'm still having the same problem, any other suggestions – Amira Elsayed Ismail Jan 08 '14 at 16:26
  • As long as Project 1 is getting it's strings via the default method this should and does work. I have used it to override values before now, both intentionally and by accident on occasion. – CodeChimp Jan 08 '14 at 16:41