Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Languge support for Gujrati and Hindi in android

Tags:

android

Hi any body know how we can support Hindi and Gujrati Languge support in android. I used below code but it is not supported, I see only box.

I put string file in res/values-hi/string.xml folder. There is some key value for Hindi language. It is used for Hindi Language:

Locale locale = new Locale("hi");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;     
getBaseContext().getResources()
                .updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics());

Anyone knows than please give me solution.

like image 561
Android007 Avatar asked Dec 26 '11 14:12

Android007


2 Answers

As gujarati and hindi languages are not supported by Android, you can still give that support to your Application.

For Gujarati copy the C:\WINDOWS\Fonts\Shruti.TTF file to your Assets folder click here to know how to make assets folder then use the following code.

TextView text_view = new TextView(this);

Typeface font = Typeface.createFromAsset(getAssets(), "Shruti.TTF");

text_view.setTypeface(font);

text_view.setText("ગુજરાતી");

Shruti.TTF file is for Gujarati font. Similarly you can add support for hindi file.

like image 90
Kri Avatar answered Sep 23 '22 14:09

Kri


Hindi and many other Indian langy=uages are not supported in Android. Though HTC is planning to provide support for some Indian languages.Read Here.

Now, the code you used to put Hindi text in your app will only work if the Android phone has built in support for Hindi language.

You need to embed Hindi fonts in your app as Kri said.

like image 43
Aakash Rayate Avatar answered Sep 23 '22 14:09

Aakash Rayate