Package com.ibm.icu.impl.locale

Examples of com.ibm.icu.impl.locale.Extension


      // other extensions are at the same level.
      // e.g. @a=ext-for-aa;calendar=japanese;m=ext-for-mm;x=priv-use

      TreeMap<String, String> kwds = new TreeMap<String, String>();
      for (Character key : extKeys) {
        Extension ext = exts.getExtension(key);
        if (ext instanceof UnicodeLocaleExtension) {
          UnicodeLocaleExtension uext = (UnicodeLocaleExtension) ext;
          Set<String> ukeys = uext.getUnicodeLocaleKeys();
          for (String bcpKey : ukeys) {
            String bcpType = uext.getUnicodeLocaleType(bcpKey);
            // convert to legacy key/type
            String lkey = bcp47ToLDMLKey(bcpKey);
            String ltype = bcp47ToLDMLType(lkey, ((bcpType.length() == 0) ? "yes" : bcpType)); // use "yes" as the value of typeless keywords
            // special handling for u-va-posix, since this is a variant, not a keyword
            if (lkey.equals("va") && ltype.equals("posix") && base.getVariant().length() == 0) {
              id = id + "_POSIX";
            } else {
              kwds.put(lkey, ltype);
            }
          }
          // Mapping Unicode locale attribute to the special keyword, attribute=xxx-yyy
          Set<String> uattributes = uext.getUnicodeLocaleAttributes();
          if (uattributes.size() > 0) {
            StringBuilder attrbuf = new StringBuilder();
            for (String attr : uattributes) {
              if (attrbuf.length() > 0) {
                attrbuf.append('-');
              }
              attrbuf.append(attr);
            }
            kwds.put(LOCALE_ATTRIBUTE_KEY, attrbuf.toString());
          }
        } else {
          kwds.put(String.valueOf(key), ext.getValue());
        }
      }

      if (!kwds.isEmpty()) {
        StringBuilder buf = new StringBuilder(id);
View Full Code Here


            // other extensions are at the same level.
            // e.g. @a=ext-for-aa;calendar=japanese;m=ext-for-mm;x=priv-use

            TreeMap<String, String> kwds = new TreeMap<String, String>();
            for (Character key : extKeys) {
                Extension ext = exts.getExtension(key);
                if (ext instanceof UnicodeLocaleExtension) {
                    UnicodeLocaleExtension uext = (UnicodeLocaleExtension)ext;
                    Set<String> ukeys = uext.getUnicodeLocaleKeys();
                    for (String bcpKey : ukeys) {
                        String bcpType = uext.getUnicodeLocaleType(bcpKey);
                        // convert to legacy key/type
                        String lkey = bcp47ToLDMLKey(bcpKey);
                        String ltype = bcp47ToLDMLType(lkey, ((bcpType.length() == 0) ? "true" : bcpType)); // use "true" as the value of typeless keywords
                        // special handling for u-va-posix, since this is a variant, not a keyword
                        if (lkey.equals("va") && ltype.equals("posix") && base.getVariant().length() == 0) {
                            id = id + "_POSIX";
                        } else {
                        kwds.put(lkey, ltype);
                    }
                    }
                    // Mapping Unicode locale attribute to the special keyword, attribute=xxx-yyy
                    Set<String> uattributes = uext.getUnicodeLocaleAttributes();
                    if (uattributes.size() > 0) {
                        StringBuilder attrbuf = new StringBuilder();
                        for (String attr : uattributes) {
                            if (attrbuf.length() > 0) {
                                attrbuf.append('-');
                            }
                            attrbuf.append(attr);
                        }
                        kwds.put(LOCALE_ATTRIBUTE_KEY, attrbuf.toString());
                    }
                } else {
                    kwds.put(String.valueOf(key), ext.getValue());
                }
            }

            if (!kwds.isEmpty()) {
                StringBuilder buf = new StringBuilder(id);
View Full Code Here

TOP

Related Classes of com.ibm.icu.impl.locale.Extension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.