java.util.Locale.getUnicodeLocaleType()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中java.util.Locale.getUnicodeLocaleType()方法的一些代码示例,展示了Locale.getUnicodeLocaleType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Locale.getUnicodeLocaleType()方法的具体详情如下:
包路径:java.util.Locale
类名称:Locale
方法名:getUnicodeLocaleType

Locale.getUnicodeLocaleType介绍

[英]Returns the Unicode locale type associated with the specified Unicode locale key for this locale. Returns the empty string for keys that are defined with no type. Returns null if the key is not defined. Keys are case-insensitive. The key must be two alphanumeric characters ([0-9a-zA-Z]), or an IllegalArgumentException is thrown.
[中]返回与此区域设置的指定Unicode区域设置键关联的Unicode区域设置类型。返回未定义类型的键的空字符串。如果未定义键,则返回null。密钥不区分大小写。键必须是两个字母数字字符([0-9a-zA-Z]),否则会引发IllegalArgumentException。

代码示例

代码示例来源:origin: stackoverflow.com

private static Calendar createCalendar(TimeZone zone,
                    Locale aLocale) {
  Calendar cal = null;

  String caltype = aLocale.getUnicodeLocaleType("ca");
  if (caltype == null) {
    // Calendar type is not specified.
    // If the specified locale is a Thai locale,
    // returns a BuddhistCalendar instance.
    if ("th".equals(aLocale.getLanguage())
        && ("TH".equals(aLocale.getCountry()))) {
      cal = new BuddhistCalendar(zone, aLocale);
    } else {
      cal = new GregorianCalendar(zone, aLocale);
    }
  } else if (caltype.equals("japanese")) {
    cal = new JapaneseImperialCalendar(zone, aLocale);
  } else if (caltype.equals("buddhist")) {
    cal = new BuddhistCalendar(zone, aLocale);
  } else {
    // Unsupported calendar type.
    // Use Gregorian calendar as a fallback.
    cal = new GregorianCalendar(zone, aLocale);
  }

  return cal;
}

代码示例来源:origin: com.anrisoftware.globalpom/globalpomutils-core

/**
 * @see java.util.Locale#getUnicodeLocaleType(java.lang.String)
 */
public String getUnicodeLocaleType(String key) {
  return locale.getUnicodeLocaleType(key);
}

代码示例来源:origin: net.time4j/time4j-core

/**
 * <p>Extracts the region or country information from given locale. </p>
 *
 * @param   locale      localization info
 * @return  usually an ISO-3166-2 region/country code in upper case or an empty string
 */
/*[deutsch]
 * <p>Ermittelt die Region- oder Landesangabe aus der angegebenen Lokalisierungsinformation. </p>
 *
 * @param   locale      localization info
 * @return  usually an ISO-3166-2 region/country code in upper case or an empty string
 */
public static String getRegion(Locale locale) {
  String region = locale.getUnicodeLocaleType("rg");
  if ((region != null) && (region.length() == 6)) {
    String upper = region.toUpperCase(Locale.US);
    if (upper.endsWith("ZZZZ")) {
      return upper.substring(0, 2);
    }
  }
  return locale.getCountry();
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

String caltype = aLocale.getUnicodeLocaleType("ca");
if (caltype == null) {

代码示例来源:origin: jtulach/bck2brwsr

String caltype = aLocale.getUnicodeLocaleType("ca");
if (caltype == null) {

代码示例来源:origin: net.time4j/time4j-core

/**
 * <p>Ermittelt, ob die angegebene Lokalisierungsinformation die Verwendung des standardm&auml;&szlig;igen
 * Wochenmodells eines Kalenders anzeigt oder nicht. </p>
 *
 * @param   locale      localization info
 * @return  boolean
 */
public static boolean useDefaultWeekmodel(Locale locale) {
  String fw = locale.getUnicodeLocaleType("fw");
  if ((fw != null) && (getWeekdayISO(fw) != 0)) {
    return false;
  }
  return getRegion(locale).isEmpty();
}

代码示例来源:origin: ldp4j/ldp4j

private Calendar nonGregorianCalendar() {
  Locale locale=null;
  for(Locale aLocale:Locale.getAvailableLocales()) {
    String unicodeLocaleType = aLocale.getUnicodeLocaleType("ca");
    if(unicodeLocaleType!=null) {
      locale=aLocale;
      break;
    }
  }
  Calendar calendar=Calendar.getInstance(locale);
  calendar.setTime(NOW);
  return calendar;
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

String numberType = locale.getUnicodeLocaleType("nu");
if (numberType != null && numberType.equals("thai")) {
  lookupLocale = new Locale("th", "TH", "TH");

代码示例来源:origin: jtulach/bck2brwsr

String numberType = locale.getUnicodeLocaleType("nu");
if (numberType != null && numberType.equals("thai")) {
  lookupLocale = new Locale("th", "TH", "TH");

代码示例来源:origin: stackoverflow.com

String caltype = aLocale.getUnicodeLocaleType("ca");
if (caltype != null) {
  switch (caltype) {

相关文章