本文整理匯總了Java中java.util.Locale.TRADITIONAL_CHINESE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Locale.TRADITIONAL_CHINESE屬性的具體用法?Java Locale.TRADITIONAL_CHINESE怎麽用?Java Locale.TRADITIONAL_CHINESE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.util.Locale
的用法示例。
在下文中一共展示了Locale.TRADITIONAL_CHINESE屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: 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();
}
示例3: 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();
}
示例4: 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;
}
示例5: isSharedFlyweight
private static boolean isSharedFlyweight(Object obj) {
if (obj == null) {
return true;
}
if (obj == Boolean.TRUE || obj == Boolean.FALSE) {
return true;
}
if (/* obj == Locale.ROOT || *//* Java 6 */
obj == Locale.ENGLISH || obj == Locale.FRENCH || obj == Locale.GERMAN || obj == Locale.ITALIAN
|| obj == Locale.JAPANESE || obj == Locale.KOREAN || obj == Locale.CHINESE
|| obj == Locale.SIMPLIFIED_CHINESE || obj == Locale.TRADITIONAL_CHINESE || obj == Locale.FRANCE
|| obj == Locale.GERMANY || obj == Locale.ITALY || obj == Locale.JAPAN || obj == Locale.KOREA
|| obj == Locale.CHINA || obj == Locale.PRC || obj == Locale.TAIWAN || obj == Locale.UK
|| obj == Locale.US || obj == Locale.CANADA || obj == Locale.CANADA_FRENCH) {
return true;
}
if (obj == Collections.EMPTY_SET || obj == Collections.EMPTY_LIST || obj == Collections.EMPTY_MAP) {
return true;
}
if (obj == BigInteger.ZERO || obj == BigInteger.ONE) {
return true;
}
if (obj == System.in || obj == System.out || obj == System.err) {
return true;
}
if (obj == String.CASE_INSENSITIVE_ORDER) {
return true;
}
if (obj == JarFile.MANIFEST_NAME) {
return true;
}
return false;
}
示例6: 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);
}
示例7: 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();
}