本文整理匯總了Java中java.util.Locale.SIMPLIFIED_CHINESE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Locale.SIMPLIFIED_CHINESE屬性的具體用法?Java Locale.SIMPLIFIED_CHINESE怎麽用?Java Locale.SIMPLIFIED_CHINESE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.util.Locale
的用法示例。
在下文中一共展示了Locale.SIMPLIFIED_CHINESE屬性的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: changeLanguage
public static void changeLanguage(Context context) {
Resources resources = context.getResources();
DisplayMetrics dm = resources.getDisplayMetrics();
Configuration config = resources.getConfiguration();
switch (SharedPreManager.getInstance().getLanguage(context)) {
case Constant.LANGUAGE_CHINA:
config.locale = Locale.SIMPLIFIED_CHINESE;
break;
case Constant.LANGUAGE_ENGLISH:
config.locale = Locale.ENGLISH;
break;
case Constant.LANGUAGE_DEFAULT:
config.locale = Locale.getDefault();
break;
}
// 應用用戶選擇語言
resources.updateConfiguration(config, dm);
}
示例2: getLocale
/**
* <pre>
* 描述:獲取本地語言
* 作者:ZhangYi
* 時間:2015年1月30日 下午1:24:06
* 參數:(參數列表)
* @param language
* @return
* </pre>
*/
public static Locale getLocale(String language) {
Locale locale = Locale.CHINESE;
if (!StringUtil.isEmpty(language)) {
language = language.toLowerCase();
if (language.indexOf("en") != -1) {
locale = Locale.ENGLISH;
}
if (language.indexOf("zh_hk") != -1) {
locale = Locale.TRADITIONAL_CHINESE;
}
if (language.indexOf("zh_cn") != -1) {
locale = Locale.SIMPLIFIED_CHINESE;
}
}
return locale;
}
示例3: checkLanguage
private void checkLanguage() {
SharedPreferences sharedPreferences = this.getSharedPreferences("set", MODE_PRIVATE);
/**
* 獲取係統配置
*/
Resources resources = getResources();
DisplayMetrics dm = resources.getDisplayMetrics();
Configuration config = resources.getConfiguration();
if (LANGUAGE_CN.equals(sharedPreferences.getString("language", "0"))) {
config.locale = Locale.SIMPLIFIED_CHINESE;
resources.updateConfiguration(config, dm);
} else if (LANGUAGE_EN.equals(sharedPreferences.getString("language", "0"))) {
config.locale = Locale.ENGLISH;
resources.updateConfiguration(config, dm);
} else {
config.locale = Locale.SIMPLIFIED_CHINESE;
resources.updateConfiguration(config, dm);
}
}
示例4: invoke
public void invoke(PipelineContext pipelineContext) throws Exception {
TurbineRunData rundata = getTurbineRunData(request);
if (ignoreTarget(rundata.getTarget())) {
pipelineContext.invokeNext();
return;
}
//默認是中文
String[] temp = rundata.getCookies().getStrings("locale");
String locale = null;
if (temp != null) {
if (temp.length > 1) {
locale = temp[temp.length - 1];
} else if (temp.length == 1) {
locale = temp[0];
}
}
if (locale == null || "".equals(locale)) {
locale = "zh";
}
Locale newLocale = Locale.SIMPLIFIED_CHINESE;
if ("en".equals(locale)) {
newLocale = Locale.ENGLISH;
} else if ("zh".equals(locale)) {
newLocale = Locale.SIMPLIFIED_CHINESE;
} else if ("zh_TW".equals(locale)) {
newLocale = Locale.TRADITIONAL_CHINESE;
}
LocaleUtil.setLocale(newLocale);
pipelineContext.invokeNext();
}
示例5: getLocale
public static Locale getLocale(String language) {
if ("en".equalsIgnoreCase(language)) {
return Locale.ENGLISH;
} else if ("zh".equalsIgnoreCase(language)) {
return Locale.SIMPLIFIED_CHINESE;
} else if ("zh_TW".equalsIgnoreCase(language)) {
return Locale.TRADITIONAL_CHINESE;
}
return Locale.getDefault();
}
示例6: getLanguageLocale
/**
* 如果不是英文、簡體中文、繁體中文,默認返回簡體中文
*
* @return
*/
private Locale getLanguageLocale() {
int languageType = CommSharedUtil.getInstance(mContext).getInt(MultiLanguageUtil.SAVE_LANGUAGE, 0);
if (languageType == LanguageType.LANGUAGE_FOLLOW_SYSTEM) {
Locale sysType = getSysLocale();
if (sysType.equals(Locale.ENGLISH)) {
return Locale.ENGLISH;
} else if (sysType.equals(Locale.TRADITIONAL_CHINESE)) {
return Locale.TRADITIONAL_CHINESE;
} else if (TextUtils.equals(sysType.getLanguage(), Locale.CHINA.getLanguage())) { //zh
if (TextUtils.equals(sysType.getCountry(), Locale.CHINA.getCountry())) { //適配華為mate9 zh_CN_#Hans
return Locale.SIMPLIFIED_CHINESE;
}
} else {
return Locale.SIMPLIFIED_CHINESE;
}
} else if (languageType == LanguageType.LANGUAGE_EN) {
return Locale.ENGLISH;
} else if (languageType == LanguageType.LANGUAGE_CHINESE_SIMPLIFIED) {
return Locale.SIMPLIFIED_CHINESE;
} else if (languageType == LanguageType.LANGUAGE_CHINESE_TRADITIONAL) {
return Locale.TRADITIONAL_CHINESE;
}
Log.e(TAG, "getLanguageLocale" + languageType + languageType);
getSystemLanguage(getSysLocale());
return Locale.SIMPLIFIED_CHINESE;
}
示例7: computePastTime
public static String computePastTime(String time) {
// Log.v(TAG, "computePastTime: " + time);
String result = "剛剛";
//2017-02-13T01:20:13.035+08:00
time = time.replace("T", " ");
time = time.substring(0, 22);
// Log.v(TAG, "computePastTime time: " + time);
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.SIMPLIFIED_CHINESE);
try {
Date t = simpleDateFormat.parse(time);
Date now = new Date(System.currentTimeMillis());
long diff = (now.getTime() - t.getTime()) / 1000;
if (diff < 60) {
result = "剛剛";
} else if ((diff /= 60) < 60) {
result = diff + "分鍾前";
} else if ((diff /= 60) < 24) {
result = diff + "小時前";
} else if ((diff /= 24) < 30) {
result = diff + "天前";
} else if ((diff /= 30) < 12) {
result = diff + "月前";
} else {
diff /= 12;
result = diff + "年前";
}
} catch (ParseException e) {
e.printStackTrace();
}
// Log.v(TAG, "computePastTime result: " + result);
return result;
}
示例8: init
public void init() {
//��ʼ��������ͼƲ���
mOrientation = new GyroscopeOrientation(this);
mStepDetector = new StepDetector(this);
//���ó�ʼ���λ����Ϣ��
mPosition[0] = 3;
mPosition[1] = 5;
mPositionEstimate = new PositionEstimate(mPosition, 0);
//���ü�¼txt�ļ���fileName��
SimpleDateFormat sdf = new SimpleDateFormat("MMdd.HHmm.ss",Locale.SIMPLIFIED_CHINESE);
String timeStr = sdf.format(new Date());
fileName = mOutputSdCard.getSDPath() + "/" + timeStr + ".txt";
}
示例9: getLocale
public static Locale getLocale(String language) {
if ("en".equalsIgnoreCase(language)) {
return Locale.ENGLISH;
} else if ("zh".equalsIgnoreCase(language)) {
return Locale.SIMPLIFIED_CHINESE;
} else if ("zh_TW".equalsIgnoreCase(language)) {
return Locale.TRADITIONAL_CHINESE;
}
return Locale.getDefault();
}
示例10: showLanguage
protected void showLanguage(String language) {
//設置應用語言類
Resources resources = getResources();
Configuration config = resources.getConfiguration();
DisplayMetrics dm = resources.getDisplayMetrics();
if (language.equals("zh")) {
config.locale = Locale.SIMPLIFIED_CHINESE;
} else {
config.locale = Locale.ENGLISH;
}
resources.updateConfiguration(config, dm);
mSharedUtil.saveStringValue("language", language);
// freshView();
}
示例11: str2Date
public static long str2Date(String str) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.SIMPLIFIED_CHINESE);
Date parse = null;
try {
parse = format.parse(str);
} catch (ParseException e) {
log.error("parse error", e);
return 0;
}
return parse.getTime();
}
示例12: date2Str
public static String date2Str(long date) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.SIMPLIFIED_CHINESE);
Date temp = new Date(date);
String format2 = format.format(temp);
return format2;
}
示例13: getLocale
private Locale getLocale(String localeName) {
String language, country;
int index;
index = localeName.indexOf('_');
if (index == -1) {
//
// Special case the builtin JDK languages
//
if (localeName.equals("de"))
return Locale.GERMAN;
if (localeName.equals("en"))
return Locale.ENGLISH;
if (localeName.equals("fr"))
return Locale.FRENCH;
if (localeName.equals("it"))
return Locale.ITALIAN;
if (localeName.equals("ja"))
return Locale.JAPANESE;
if (localeName.equals("ko"))
return Locale.KOREAN;
if (localeName.equals("zh"))
return Locale.CHINESE;
language = localeName;
country = "";
} else {
if (localeName.equals("zh_CN"))
return Locale.SIMPLIFIED_CHINESE;
if (localeName.equals("zh_TW"))
return Locale.TRADITIONAL_CHINESE;
//
// JDK also has constants for countries: en_GB, en_US, en_CA,
// fr_FR, fr_CA, de_DE, ja_JP, ko_KR. We don't use those.
//
language = localeName.substring(0, index);
country = localeName.substring(index + 1);
}
return new Locale(language, country);
}