当前位置: 首页>>代码示例>>Java>>正文


Java Locale.getISOLanguages方法代码示例

本文整理汇总了Java中java.util.Locale.getISOLanguages方法的典型用法代码示例。如果您正苦于以下问题:Java Locale.getISOLanguages方法的具体用法?Java Locale.getISOLanguages怎么用?Java Locale.getISOLanguages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Locale的用法示例。


在下文中一共展示了Locale.getISOLanguages方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isLocaleSupported

import java.util.Locale; //导入方法依赖的package包/类
private static void isLocaleSupported(String member, String value)
        throws ValidationException {
    if (value == null || value.trim().length() == 0) {
        return;
    }

    boolean invalidLocale = true;
    String[] locales = Locale.getISOLanguages();// .getAvailableLocales();
    for (String locale : locales) {
        if (locale.equals(value)) {
            invalidLocale = false;
            break;
        }
    }
    if (invalidLocale) {
        ValidationException vf = new ValidationException(
                ReasonEnum.INVALID_LOCALE, member, new Object[] { value });
        logValidationFailure(vf);
        throw vf;
    }

}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:BLValidator.java

示例2: Test4126880

import java.util.Locale; //导入方法依赖的package包/类
/**
 * @bug 4126880
 */
void Test4126880() {
    String[] test;

    test = Locale.getISOCountries();
    test[0] = "SUCKER!!!";
    test = Locale.getISOCountries();
    if (test[0].equals("SUCKER!!!"))
        errln("Changed internal country code list!");

    test = Locale.getISOLanguages();
    test[0] = "HAHAHAHA!!!";
    test = Locale.getISOLanguages();
    if (test[0].equals("HAHAHAHA!!!")) // Fixed typo
        errln("Changes internal language code list!");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:LocaleTest.java

示例3: main

import java.util.Locale; //导入方法依赖的package包/类
public static void main (String[] args) throws Exception {
    Locale es = new Locale ("es");
    String[] isoLangs = es.getISOLanguages ();
    String error = "";

    for (int i = 0; i < isoLangs.length; i++) {
        Locale current = new Locale (isoLangs[i]);
        String localeString = current.getDisplayLanguage (es);
        String startLetter = localeString.substring (0,1);
        if (!startLetter.toLowerCase (es).equals (startLetter)){
            error = error + "\n\t"+ isoLangs[i] + " " + localeString;
        }
    }

    if (error.length () > 0){
        throw new Exception ("\nFollowing language names starts with upper-case letter: "
                + error + "\nLower-case expected!");
    }

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:Bug6275682.java

示例4: Test4126880

import java.util.Locale; //导入方法依赖的package包/类
/**
 * @bug 4126880
 */
void Test4126880() {
    String[] test;

    test = Locale.getISOCountries();
    test[0] = "SUCKER!!!";
    test = Locale.getISOCountries();
    if (test[0].equals("SUCKER!!!")) {
        errln("Changed internal country code list!");
    }

    test = Locale.getISOLanguages();
    test[0] = "HAHAHAHA!!!";
    test = Locale.getISOLanguages();
    if (test[0].equals("HAHAHAHA!!!")) { // Fixed typo
        errln("Changes internal language code list!");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:LocaleTest.java

示例5: getLanguageList

import java.util.Locale; //导入方法依赖的package包/类
protected String[] getLanguageList() {
  if (languageList == null) {
    String[] langs = Locale.getISOLanguages();
    ArrayList<String> sortedLangs = new ArrayList<String>();
    for (int i = 0; i < langs.length; i++) {
      String lang =
        (new Locale(langs[i])).getDisplayLanguage(Locale.getDefault());
      languages.put(lang, langs[i]);
      sortedLangs.add(lang);
    }
    Collections.sort(sortedLangs, Collator.getInstance(Locale.getDefault()));
    languageList = sortedLangs.toArray(new String[sortedLangs.size()]);
  }
  return languageList;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:16,代码来源:LocaleConfigurer.java

示例6: checkLocale

import java.util.Locale; //导入方法依赖的package包/类
private boolean checkLocale(String languageISOCode) {
    String[] locales = Locale.getISOLanguages();
    for (String l : locales) {
        if (l.equalsIgnoreCase(languageISOCode)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:10,代码来源:OperatorServiceLocalBean.java

示例7: isLocaleValid

import java.util.Locale; //导入方法依赖的package包/类
public static boolean isLocaleValid(String languageISOCode) {
    String[] locales = Locale.getISOLanguages();
    for (String l : locales) {
        if (l.equalsIgnoreCase(languageISOCode)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:10,代码来源:LocaleUtils.java


注:本文中的java.util.Locale.getISOLanguages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。