Nur El-din
Nur El-din

Reputation: 133

Android: how to change number format to Hindi-format (Eastern Arabic numerals) for the whole application?

Like so Eastern Arabic numerals {٠١٢٣٤٥٦٧٨٩}
I use this method to change App language but it does not work completely to show the Hindi Numbers

    Locale Language = new Locale("ar");    
    Resources resources = context.getResources();    
    DisplayMetrics displayMetrics = resources.getDisplayMetrics();   
    Configuration conf = resources.getConfiguration();   
    conf.locale= Language;   
    Language.setDefault(Language);   
    conf.setLayoutDirection(Language);   
    resources.updateConfiguration(conf, displayMetrics);   

Upvotes: 3

Views: 2331

Answers (1)

Joni
Joni

Reputation: 111369

Like with everything related to i18n, the app must be written in a way that permits localization.

For example, Integer.toString(i) will always use digits 0-9. To get localized numerals you must use String.format("%d", i) or NumberFormat.getInstance().format(i) instead.

Upvotes: 5

Related Questions