Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Language support on android

I want to type in different languages in android other than English like Hebrew by providing ttf files. Are there any in build API's so I can use that?

like image 212
Sam97305421562 Avatar asked Nov 24 '25 06:11

Sam97305421562


2 Answers

There is an example on how to use custom typefaces in the API Demos. That said, you may not need to. This article seems to indicate that the default font (Droid) probably contains all the necessary characters for (at least) the target markets for Android.

Other than that, the developer site has pretty good documentation on how to "internationalize" an application.

like image 131
Jeremy Logan Avatar answered Nov 26 '25 19:11

Jeremy Logan


You can localize you application by using ttf files

Here is the sample code to start with

Create a folder under assets with name "fonts". Copy your language file (ex: mylang.ttf).

Load this file using the following code:

Typeface myfont;
myfont=Typeface.createFromAsset(getAssets(),"fonts/mylang.ttf");
TextView textview = (TextView)findViewById(R.id.TextView01);
textview.setText(R.string.my_textview);
    textview.setTypeface(myfont);

In string.xml, give "some language string" for my_textview.

Now you can see your language text in android device/emulator.

like image 21
satesh Avatar answered Nov 26 '25 21:11

satesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!