vlio20
vlio20

Reputation: 9295

Hebrew language not showing - Android

I have created 2 string files one the default under res/values/strings.xml and the other under res/values-he/strings.xml. I am opening my app, while the os is configured to be in Hebrew, but still I see the values of the default strings which are in English. Is there any thing more to do?

Note: in the eclipse graphical layout editor I can choose Hebrew and see that it works fine.

Here is some of my default strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MyApp</string>
<string name="title_activity_splash">MyApp</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="title_activity_login">Login</string>
<string name="email">Email</string>
<string name="password">Password</string>
<string name="forgot_password">Forgot password?</string>
<string name="sign_up">Sign up</string>
<string name="login">Login</string> 
.
.
.

and here is all (for now) my hebrew strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="action_settings">הגדרות</string>
    <string name="hello_world">שלום עולם</string>
    <string name="email">דואל</string>
    <string name="password">סיסמא</string>
    <string name="forgot_password">שכחת סיסמא</string>
    <string name="sign_up">רישום</string>
    <string name="login">התחברות</string>


</resources>

Here it in eclipse:

enter image description here

here it on the device (device os in hebrew):

enter image description here

Upvotes: 3

Views: 3025

Answers (2)

Andr&#233; Luiz Reis
Andr&#233; Luiz Reis

Reputation: 2333

What solved the problem for me was to use the folder values-iw.

Upvotes: 2

Phant&#244;maxx
Phant&#244;maxx

Reputation: 38098

OK, you correctly have:

res/values/strings.xml

and

res/values-he/strings.xml

With the correct structure, be also sure that the strings have the very same names in each strings.xml file, or the trick won't work.

The missing strings in a translation file won't be translated and the default strings (from res/values/strings.xml) will be used instead.

For hebrew, in particular, on some devices values-he is recognized. in some others it's values-iw.
So, make a copy of values-he and name it values-iw. Keep both in your structure.

Upvotes: 10

Related Questions