Package com.ibm.icu.util

Examples of com.ibm.icu.util.ULocale$IDParser


    /*
     * Test method for 'com.ibm.icu.x.util.ULocale.setKeywordValue(String, String)'
     */
    public void testSetKeywordValueStringString() {
        ULocale munged = longULocale.setKeywordValue("key", "C#");
        assertEquals("C#", munged.getKeywordValue("key"));
        munged = munged.setKeywordValue("zzyzx", "grue");
        assertEquals("grue", munged.getKeywordValue("zzyzx"));
    }
View Full Code Here


    /*
     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant()'
     */
    public void testGetDisplayVariant() {
        String idv = new ULocale("de_DE_PHONEBOOK").getDisplayVariant();
        String jdv = new Locale("de", "DE", "PHONEBOOK").getDisplayVariant();
        assertEquals(jdv, idv);
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayVariant(ULocale)'
     */
    public void testGetDisplayVariantULocale() {
        String idv = new ULocale("de_DE_PHONEBOOK").getDisplayVariant(ULocale.GERMANY);
        String jdv = new Locale("de", "DE", "PHONEBOOK").getDisplayVariant(Locale.GERMANY);
        assertEquals(jdv, idv);
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String)'
     */
    public void testGetDisplayKeywordValueString() {
        ULocale ul = new ULocale("de_DE@collation=phonebook");
        String idk = ul.getDisplayKeywordValue("collation");
        if (ICUTestCase.testingWrapper) {
            assertEquals("phonebook", idk);
        } else {
            // TODO: find real value
            assertEquals("phonebook", idk);
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.x.util.ULocale.getDisplayKeywordValue(String, ULocale)'
     */
    public void testGetDisplayKeywordValueStringULocale() {
        ULocale ul = new ULocale("de_DE@collation=phonebook");
        String idk = ul.getDisplayKeywordValue("collation", ULocale.GERMANY);
        if (ICUTestCase.testingWrapper) {
            assertEquals("phonebook", idk);
        } else {
            // TODO: find real value
            assertEquals("phonebook", idk);
View Full Code Here

     * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(String, ULocale[], boolean[])'
     */
    public void testAcceptLanguageStringULocaleArrayBooleanArray() {
        boolean[] fallback = new boolean[1];
        ULocale[] locales = {
            new ULocale("en_CA"),
            new ULocale("es_US"),
        };
        ULocale result = ULocale.acceptLanguage("en-US, en-GB, en-CA, es-US", locales, fallback);
        assertEquals(new ULocale("en_CA"), result);
        assertFalse(fallback[0]);
        result = ULocale.acceptLanguage("en-US, en-GB, es-US-NEWMEXICO", locales, fallback);
        assertEquals(new ULocale("es_US"), result);
        assertTrue(fallback[0]);
    }
View Full Code Here

     * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(ULocale[], ULocale[], boolean[])'
     */
    public void testAcceptLanguageULocaleArrayULocaleArrayBooleanArray() {
        boolean[] fallback = new boolean[1];
        ULocale[] locales = {
            new ULocale("en_CA"),
            new ULocale("es_US"),
        };
        ULocale[] accept_locales = {
            new ULocale("en_US"),
            new ULocale("en_GB"),
            new ULocale("en_CA"),
            new ULocale("es_US"),
        };
        ULocale[] accept_locales2 = {
            new ULocale("en_US"),
            new ULocale("en_GB"),
            new ULocale("es_US_NEWMEXICO"),
        };
        ULocale result = ULocale.acceptLanguage(accept_locales, locales, fallback);
        assertEquals(new ULocale("en_CA"), result);
        assertFalse(fallback[0]);
        result = ULocale.acceptLanguage(accept_locales2, locales, fallback);
        assertEquals(new ULocale("es_US"), result);
        assertTrue(fallback[0]);
    }
View Full Code Here

    /*
     * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(String, boolean[])'
     */
    public void testAcceptLanguageStringBooleanArray() {
        boolean[] fallback = new boolean[1];
        ULocale result = ULocale.acceptLanguage("en-CA, en-GB, es-US", fallback);
        assertEquals(new ULocale("en_CA"), result);
        assertFalse(fallback[0]);
        result = ULocale.acceptLanguage("es-US-NEWMEXICO", fallback);
        assertNotNull(result); // actual result depends on jdk
        assertTrue(fallback[0]);
    }
View Full Code Here

     * Test method for 'com.ibm.icu.x.util.ULocale.acceptLanguage(ULocale[], boolean[])'
     */
    public void testAcceptLanguageULocaleArrayBooleanArray() {
        boolean[] fallback = new boolean[1];
        ULocale[] accept_locales = {
            new ULocale("en_CA"),
            new ULocale("en_GB"),
            new ULocale("es_US"),
        };
        ULocale[] accept_locales2 = {
            new ULocale("es_US_NEWMEXICO"),
        };
        ULocale result = ULocale.acceptLanguage(accept_locales, fallback);
        assertEquals(new ULocale("en_CA"), result);
        assertFalse(fallback[0]);
        result = ULocale.acceptLanguage(accept_locales2, fallback);
        assertNotNull(result); // actual result depends on jdk
        assertTrue(fallback[0]);
    }
View Full Code Here

     * Convenience override of getDisplayNames(ULocale, Comparator, String) that
     * uses the current default Locale as the locale, null as
     * the comparator, and null for the matchID.
     */
    public SortedMap getDisplayNames() {
        ULocale locale = ULocale.getDefault();
        return getDisplayNames(locale, null, null);
    }
View Full Code Here

TOP

Related Classes of com.ibm.icu.util.ULocale$IDParser

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.