Convert page to index scripts

I just created a text page in my application, and now I want to dynamically change the language of this page to Indian languages ​​such as Telugu, Tamil, Bangla, Gujrati and Punjabi.

I researched a lot and realized that there are only 2 methods for this (please correct me if I am wrong): -

1) Using string localization http://developer.android.com/guide/topics/resources/localization.html . But the problem is that if the Android phone supports these languages, then it works, otherwise it displays the fields in place of the fonts.

2) Using custom fonts to change the language, for example

TextView tv=(TextView)findViewById(R.id.custom); Typeface face=Typeface.createFromAsset(getAssets(),"fonts/Verdana.ttf"); tv.setTypeface(face); 

But here the problem is rendering. Fonts do not display properly.

Please suggest me which option to choose and how to overcome it.

I also want to mention that I want to support it on Android 2.3 and higher.

+4
source share
1 answer

Prior to Android 3, you need to use the appropriate font plus localization to display characters from special scripts.

For Android 3+, it’s enough to use localization in most cases. The exceptions are scripts in Arabic, Hebrew, indexes and several others, where you may need the appropriate font in addition to localization in order to correctly display these special characters in your Android application.

AFAIK, Verdana ONLY supports European scripts such as Latin-1 , Latin extended-A , Latin Extended-B , extended Latin , basic Greek and Cyrillic . While Telugu, Tamil, Bengali, Gujarat are part of South Asian scripts - not sure about Punjabi (see Unicode Consortium for more information on Unicode scripts.) I think you need to find an open source font (so you don’t you need to pay loyalty when using proprietary fonts) that support the scripts that you want to implement in your application.

0
source

Source: https://habr.com/ru/post/1448068/


All Articles