android 多语言不起作用,Android本地化语言环境不起作用,所有区域代码都存在问题...

我需要将除瑞士之类的子语言环境添加到我的应用程序中,而不是普通的德语.

我找到的德语资源文件夹的语言环境扩展名为de.所以我的文件夹名为“values-de”.这很好.

然后我添加了“values-de_CH”并继续收到错误“无效的资源目录名称”.

我也试过“values-de_rCH”和“values-de_ch” – 无济于事.

当我将手机设置为德语(瑞士)并从应用程序中打印区域设置时:

String locale = java.util.Locale.getDefault().getDisplayName();

String locale2 = java.util.Locale.getDefault().getLanguage();

if (DEBUG)

Log.i(this.getClass().getSimpleName(), " ->" + "locale= " + locale

+ "country= " + locale2);

,它也只打印“德”

我也试过“values-en_US”并得到了同样的错误.

当我打印所有可用的语言环境时,我甚至得到这些:

07-30 11:45:38.236: D/asset(2298): locale 32: 'uk_UA'

07-30 11:45:38.236: D/asset(2298): locale 33: 'en_ZA'

07-30 11:45:38.236: D/asset(2298): locale 34: 'en_GB'

07-30 11:45:38.236: D/asset(2298): locale 35: 'et_EE'

07-30 11:45:38.236: D/asset(2298): locale 36: 'ga_IE'

07-30 11:45:38.236: D/asset(2298): locale 37: 'en_IE'

07-30 11:45:38.236: D/asset(2298): locale 38: 'bg_BG'

07-30 11:45:38.236: D/asset(2298): locale 39: 'fi_FI'

07-30 11:45:38.236: D/asset(2298): locale 40: 'sl_SI'

07-30 11:45:38.236: D/asset(2298): locale 41: 'mk_MK'

07-30 11:45:38.236: D/asset(2298): locale 42: 'sk_SK'

07-30 11:45:38.236: D/asset(2298): locale 43: 'no_NO'

07-30 11:45:38.236: D/asset(2298): locale 44: 'ro_RO'

07-30 11:45:38.236: D/asset(2298): locale 45: 'hr_HR'

07-30 11:45:38.236: D/asset(2298): locale 46: 'es_ES'

07-30 11:45:38.236: D/asset(2298): locale 47: 'is_IS'

07-30 11:45:38.236: D/asset(2298): locale 48: 'sr_RS'

07-30 11:45:38.236: D/asset(2298): locale 49: 'en_US'

07-30 11:45:38.236: D/asset(2298): locale 50: 'es_US'

07-30 11:45:38.236: D/asset(2298): locale 51: 'lt_LT'

07-30 11:45:38.236: D/asset(2298): locale 52: 'pt_PT'

07-30 11:45:38.236: D/asset(2298): locale 53: 'en_AU'

07-30 11:45:38.236: D/asset(2298): locale 54: 'hu_HU'

07-30 11:45:38.236: D/asset(2298): locale 55: 'ru_RU'

07-30 11:45:38.236: D/asset(2298): locale 56: 'lv_LV'

07-30 11:45:38.236: D/asset(2298): locale 57: 'kk_KZ'

07-30 11:45:38.236: D/asset(2298): locale 58: 'en_NZ'

07-30 11:45:38.236: D/asset(2298): locale 59: 'nl_BE'

07-30 11:45:38.241: D/asset(2298): locale 60: 'de_DE'

07-30 11:45:38.241: D/asset(2298): locale 61: 'sv_SE'

07-30 11:45:38.241: D/asset(2298): locale 62: 'de_CH'

07-30 11:45:38.241: D/asset(2298): locale 63: 'fr_CH'

07-30 11:45:38.241: D/asset(2298): locale 64: 'da_DK'

07-30 11:45:38.241: D/asset(2298): locale 65: 'nl_NL'

07-30 11:45:38.241: D/asset(2298): locale 66: 'pl_PL'

07-30 11:45:38.241: D/asset(2298): locale 67: 'fr_FR'

07-30 11:45:38.241: D/asset(2298): locale 68: 'el_GR'

07-30 11:45:38.241: D/asset(2298): locale 69: 'ko_KR'

07-30 11:45:38.241: D/asset(2298): locale 70: 'tr_TR'

07-30 11:45:38.241: D/asset(2298): locale 71: 'de_AT'

07-30 11:45:38.241: D/asset(2298): locale 72: 'it_IT'

07-30 11:45:38.241: D/asset(2298): locale 73: 'cs_CZ'

有没有办法让这些地区或有什么特别的我需要做?

非常感谢

解决方法:

你需要使用“values-de-rCH”.文件名中不允许使用下划线.

标签:android,locale

来源: https://codeday.me/bug/20190901/1786149.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值