當前位置: 首頁>>代碼示例>>Java>>正文


Java Locale.SIMPLIFIED_CHINESE屬性代碼示例

本文整理匯總了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);
}
 
開發者ID:Yuanhongliang,項目名稱:HLOLI,代碼行數:18,代碼來源:App.java

示例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;
}
 
開發者ID:dev-share,項目名稱:database-transform-tool,代碼行數:26,代碼來源:ResourceHolder.java

示例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);
        }

    }
 
開發者ID:stewForAni,項目名稱:Lamp,代碼行數:26,代碼來源:WifiConnectActivity.java

示例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();
}
 
開發者ID:dachengxi,項目名稱:EatDubbo,代碼行數:33,代碼來源:LocaleValve.java

示例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();
}
 
開發者ID:dachengxi,項目名稱:EatDubbo,代碼行數:10,代碼來源:LocaleUtils.java

示例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;
}
 
開發者ID:finddreams,項目名稱:AndroidMultiLanguage,代碼行數:31,代碼來源:MultiLanguageUtil.java

示例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;
}
 
開發者ID:GcsSloop,項目名稱:diycode,代碼行數:33,代碼來源:TimeUtil.java

示例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";
  }
 
開發者ID:HyfUestc,項目名稱:PDR,代碼行數:13,代碼來源:PDRService.java

示例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();
}
 
開發者ID:l1325169021,項目名稱:github-test,代碼行數:10,代碼來源:LocaleUtils.java

示例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();
    }
 
開發者ID:FacePlusPlus,項目名稱:MegviiFacepp-Android-SDK,代碼行數:14,代碼來源:LoadingActivity.java

示例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();
}
 
開發者ID:HankXV,項目名稱:Limitart,代碼行數:11,代碼來源:TimeUtil.java

示例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;
}
 
開發者ID:HankXV,項目名稱:Limitart,代碼行數:6,代碼來源:TimeUtil.java

示例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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:42,代碼來源:MessageCatalog.java


注:本文中的java.util.Locale.SIMPLIFIED_CHINESE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。