Search code examples
javaandroidlocalearabicmultilingual

Use arabic letters with arabic numbers


It might sounds weird, but the fact is that Android handles languages really bad. Take Arabic for example :

Arabs in the east-part use arabic letters (ابجدهوز) and persian numbers (٠١٢٣٤٥٦٧٨٩).

Arabs in west-part use arabic letters (ابجدهوز) and arabic numbers (0123456789).

Android only have one kind of Arabic which is the first.

I'm looking for a way to apply the second kind in my application (use arabic letters but also arabic numbers)

Is there any way to do so?


Solution

  • Try to specify the numbering system (nu) in the default locale. For example, the following locale would make the system displaying Indian numbers (٠١٢٣٤٥٦٧٨٩)

    Locale AR_LOCALE_EAST_NUMBERS = new Locale.Builder().setLanguageTag("ar-u-nu-arab").build();
    Locale.setDefault(AR_LOCALE_EAST_NUMBERS);