Pooja Roy Pooja Roy - 1 year ago 55
Android Question

How to change the language of my application based on the language of the keyboard?

I am developing an android application. In that application get the language of the keyboard of user android device. If the user keyboard is in French language then The whole application font should be turn into French language.

In that I had tried following demo Example.

In Values->strings

<?xml version="1.0" encoding="utf-8"?>
<string name="app_name">Localizationdemo</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>

in Values-fr->strings

<?xml version="1.0" encoding="utf-8"?>
<string name="title">Mon Application</string>
<string name="hello_world">Bonjour le monde !</string>

But in that I only get English language "Hello world" and my keyboard is in French language.

Answer Source

hope that u have written these lines in your code

Locale locale = new Locale("FR");
Configuration config = new Configuration();
config.locale = locale;
getApplicationContext().getResources().updateConfiguration(config, null);

because when you set local language as fr it will get the strings from Values-fr same for other language if you set it as it it will consider as you are local language italic and e.t.c..

Note: if your device may be not compatible for all the languages, in that case you need to use external ttf

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download