Package org.apache.abdera.i18n.rfc4646.enums

Examples of org.apache.abdera.i18n.rfc4646.enums.Language


  public StreamWriter writeLanguage(Lang lang) {
    return writeLanguage(lang.toString());
  }
 
  public StreamWriter writeLanguage(Locale locale) {
    return writeLanguage(new Lang(locale));
  }
View Full Code Here


        return language;
    }

    public Lang getLanguageTag() {
        String lang = getLanguage();
        return (lang != null) ? new Lang(lang) : null;
    }
View Full Code Here

        return (T)getWrapped((Element)this.getFirstChildWithName(qname));
    }

    public Lang getLanguageTag() {
        String lang = getLanguage();
        return (lang != null) ? new Lang(lang) : null;
    }
View Full Code Here

    return language;
  }
 
  public Lang getLanguageTag() {
    String lang = getLanguage();
    return (lang != null) ? new Lang(lang) : null;
  }
View Full Code Here

  public StreamWriter writeLanguage(Lang lang) {
    return writeLanguage(lang.toString());
  }
 
  public StreamWriter writeLanguage(Locale locale) {
    return writeLanguage(new Lang(locale));
  }
View Full Code Here

  public void testLang() throws Exception {
    Abdera abdera = new Abdera();
    Entry entry = abdera.newEntry();
    entry.setLanguage("en-US");
    assertEquals(entry.getLanguage(),"en-US");
    Lang lang = entry.getLanguageTag();
    assertNotNull(lang);
    assertEquals(lang.getLanguage().getName(),"en");
    assertEquals(lang.getRegion().getName(), "US");
    assertEquals(lang.getLocale(), java.util.Locale.US);
  }
View Full Code Here

  public void testLang() throws Exception {
    Abdera abdera = new Abdera();
    Entry entry = abdera.newEntry();
    entry.setLanguage("en-US");
    assertEquals(entry.getLanguage(),"en-US");
    Lang lang = entry.getLanguageTag();
    assertNotNull(lang);
    assertEquals(lang.getLanguage().getName(),"en");
    assertEquals(lang.getRegion().getName(), "US");
    assertEquals(lang.getLocale(), java.util.Locale.US);
  }
View Full Code Here

    return (T)getWrapped((Element)this.getFirstChildWithName(qname));
  }
 
  public Lang getLanguageTag() {
    String lang = getLanguage();
    return (lang != null) ? new Lang(lang) : null;
  }
View Full Code Here

        List<Link> matching = new ArrayList<Link>();
        for (Range range : ranges) {
            for (Link link : links) {
                String hreflang = link.getHrefLang();
                if (hreflang != null) {
                    Lang lang = new Lang(hreflang);
                    Range basic = range.toBasicRange();
                    Lang blang = !basic.toString().equals("*") ? new Lang(basic.toString()) : null;
                    if (range.matches(lang) || (blang != null && lang.isParentOf(blang)))
                        matching.add(link);
                }
            }
            Collections.sort(matching, new Comparator<Link>() {
                public int compare(Link o1, Link o2) {
                    Lang l1 = new Lang(o1.getHrefLang());
                    Lang l2 = new Lang(o2.getHrefLang());
                    return l1.compareTo(l2);
                }
            });
        }
        return matching.toArray(new Link[matching.size()]);
View Full Code Here

     */
    public static <T extends Element> Direction guessDirectionFromLanguage(T element, boolean ignoredir) {
        if (!ignoredir && hasDirection(element))
            return getDirection(element);
        String language = element.getLanguage();
        Lang lang = language != null ? new Lang(language) : new Lang(Locale.getDefault());
        return Bidi.guessDirectionFromLanguage(lang);
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.i18n.rfc4646.enums.Language

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.