没有合适的资源?快使用搜索试试~ 我知道了~
话不多说,请看代码: public static boolean isZh(Context context) { Locale locale = context.getResources().getConfiguration().locale; String language = locale.getLanguage(); if (language.endsWith(zh)) return true; else return false; } PS: android判断当前系统用的是什么语言 判断国家: 中文:getResources().getConfiguration(
资源推荐
资源详情
资源评论
Android 判断当前语言环境是否是中文环境判断当前语言环境是否是中文环境
话不多说,请看代码:
public static boolean isZh(Context context) {
Locale locale = context.getResources().getConfiguration().locale;
String language = locale.getLanguage();
if (language.endsWith("zh"))
return true;
else
return false;
}
PS: android判断当前系统用的是什么语言判断当前系统用的是什么语言
判断国家:判断国家:
中文:getResources().getConfiguration().locale.getCountry().equals("CN")
繁体中文: getResources().getConfiguration().locale.getCountry().equals("TW")
英文(英式):getResources().getConfiguration().locale.getCountry().equals("UK")
英文(美式):getResources().getConfiguration().locale.getCountry().equals("US")
如果不清楚当前国家的简写,可以直接
System.out(getResources().getConfiguration().locale.getCountry());打印出来即可
下面是判断是否是中文或者繁体中文下面是判断是否是中文或者繁体中文(台湾台湾)::
public boolean isLunarSetting() {
String language = getLanguageEnv();
if (language != null
&& (language.trim().equals("zh-CN") || language.trim().equals("zh-TW")))
return true;
else
return false;
}
private String getLanguageEnv() {
Locale l = Locale.getDefault();
String language = l.getLanguage();
String country = l.getCountry().toLowerCase();
if ("zh".equals(language)) {
if ("cn".equals(country)) {
language = "zh-CN";
} else if ("tw".equals(country)) {
language = "zh-TW";
}
} else if ("pt".equals(language)) {
if ("br".equals(country)) {
language = "pt-BR";
} else if ("pt".equals(country)) {
language = "pt-PT";
}
}
return language;
}
String format = Settings.System.getString(context4Year.getContentResolver(), Settings.System.DATE_FORMAT);
您可能感兴趣的文章您可能感兴趣的文章:Android应用的多语言支持的实现方法Android实现app应用多语言切换功能Android app应用多语言切换
功能实现Android 系统语言切换监听和设置实例代码android动态设置app当前运行语言的方法Android实现应用内置语言切换
功能Android实现系统语言切换功能Android 各国语言缩写及简称详细介绍Android编程实现动态支持多语言的方法
资源评论
weixin_38582909
- 粉丝: 5
- 资源: 975
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功