1

I need to replace the name of the AD months to Persian months name in a datepicker, how to do it?

public static final String[] MONTHS = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

to

public static final String[] JALALI_MONTHS = {"Farvardin", "Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Meher","Aban","Azar","Dey","Bahman","Esfand"};
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
MOHS3N
  • 229
  • 1
  • 4
  • 13

1 Answers1

0

I recommend to you use String resources to do it

resources>
    <string-array name="months_array">
        <item>Farvardin</item>
        <item>Ordibehesht</item>
        <item>Khordad</item>
        <item>Tir</item>
        <item>Mordad</item>
        <item>Shahrivar</item>
        <item>Meher</item>
        <item>Aban</item>
        <item>Azar</item>
        <item>Dey</item>
        <item>Bahman</item>
        <item>Esfand</item>
    </string-array>
</resources>

And then if you want it as a multilanguage create a new strings.xml named values-fa and then put inside this strings.xml it should be like this :

res/
    values/
        strings.xml
     values-fa/
        strings.xml

But if you want to change the DatePicker languague you should do something like this answer from @Igor K, maybe it helps :)

Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148