我需要在日期选择器中将AD月份的名称替换为波斯月份名称,该怎么做?
public static final String[] MONTHS = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
到
public static final String[] JALALI_MONTHS = {"Farvardin", "Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Meher","Aban","Azar","Dey","Bahman","Esfand"};
答案 0 :(得分:0)
我建议您使用String resources
来执行此操作
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>
然后,如果您希望将其作为多语言创建一个名为strings.xml
的新values-fa
然后放入此strings.xml
,那么它应该是这样的:
res/
values/
strings.xml
values-fa/
strings.xml
但是如果你想改变DatePicker
语言,你应该做@Igor K
这样的回答,也许有帮助:)