java.util.Locale.FilteringMode Java Examples

The following examples show how to use java.util.Locale.FilteringMode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Bug8159420.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void testFilter(FilteringMode mode) {

        String ranges = "hi-IN, itc-Ital";
        String tags = "hi-IN, itc-Ital";
        List<LanguageRange> priorityList = LanguageRange.parse(ranges);
        List<Locale> tagList = generateLocales(tags);
        String actualLocales = showLocales(Locale.filter(priorityList, tagList, mode));
        String expectedLocales = "hi-IN, itc-Ital";

        if (!expectedLocales.equals(actualLocales)) {
            System.err.println("testFilter(" + mode + ") failed on language ranges:"
                    + " [" + ranges + "] and language tags: [" + tags + "]");
            err = true;
        }
    }
 
Example #2
Source File: Bug8040211.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static void test_filter() {
    boolean error = false;

    String ranges = "mtm-RU, en-gb-oed, coy, ar-HY";
    String tags = "de-DE, en, mtm-RU, ymt-RU, en-gb-oxendict, ja-JP, pij, nts, ar-arevela";
    FilteringMode mode = EXTENDED_FILTERING;

    List<LanguageRange> priorityList = LanguageRange.parse(ranges);
    List<Locale> tagList = generateLocales(tags);
    String actualLocales
            = showLocales(Locale.filter(priorityList, tagList, mode));
    String expectedLocales = "mtm-RU, ymt-RU, en-GB-oxendict, nts, pij";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#1 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    ranges = "phr-*-IN, ja-JP";
    tags = "en, pmu-Guru-IN, ja-Latn-JP, iw";
    mode = EXTENDED_FILTERING;

    priorityList = LanguageRange.parse(ranges);
    tagList = generateLocales(tags);
    actualLocales = showLocales(Locale.filter(priorityList, tagList, mode));
    expectedLocales = "pmu-Guru-IN, ja-Latn-JP";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#2 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    if (error) {
        err = true;
        System.out.println("  test_filter() failed.");
    } else {
        System.out.println("  test_filter() passed.");
    }
}
 
Example #3
Source File: Bug8040211.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static void test_filter() {
    boolean error = false;

    String ranges = "mtm-RU, en-gb-oed, coy, ar-HY";
    String tags = "de-DE, en, mtm-RU, ymt-RU, en-gb-oxendict, ja-JP, pij, nts, ar-arevela";
    FilteringMode mode = EXTENDED_FILTERING;

    List<LanguageRange> priorityList = LanguageRange.parse(ranges);
    List<Locale> tagList = generateLocales(tags);
    String actualLocales
            = showLocales(Locale.filter(priorityList, tagList, mode));
    String expectedLocales = "mtm-RU, ymt-RU, en-GB-oxendict, nts, pij";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#1 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    ranges = "phr-*-IN, ja-JP";
    tags = "en, pmu-Guru-IN, ja-Latn-JP, iw";
    mode = EXTENDED_FILTERING;

    priorityList = LanguageRange.parse(ranges);
    tagList = generateLocales(tags);
    actualLocales = showLocales(Locale.filter(priorityList, tagList, mode));
    expectedLocales = "pmu-Guru-IN, ja-Latn-JP";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#2 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    if (error) {
        err = true;
        System.out.println("  test_filter() failed.");
    } else {
        System.out.println("  test_filter() passed.");
    }
}
 
Example #4
Source File: Bug8040211.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static void test_filter() {
    boolean error = false;

    String ranges = "mtm-RU, en-gb-oed, coy, ar-HY";
    String tags = "de-DE, en, mtm-RU, ymt-RU, en-gb-oxendict, ja-JP, pij, nts, ar-arevela";
    FilteringMode mode = EXTENDED_FILTERING;

    List<LanguageRange> priorityList = LanguageRange.parse(ranges);
    List<Locale> tagList = generateLocales(tags);
    String actualLocales
            = showLocales(Locale.filter(priorityList, tagList, mode));
    String expectedLocales = "mtm-RU, ymt-RU, en-GB-oxendict, nts, pij";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#1 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    ranges = "phr-*-IN, ja-JP";
    tags = "en, pmu-Guru-IN, ja-Latn-JP, iw";
    mode = EXTENDED_FILTERING;

    priorityList = LanguageRange.parse(ranges);
    tagList = generateLocales(tags);
    actualLocales = showLocales(Locale.filter(priorityList, tagList, mode));
    expectedLocales = "pmu-Guru-IN, ja-Latn-JP";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#2 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    if (error) {
        err = true;
        System.out.println("  test_filter() failed.");
    } else {
        System.out.println("  test_filter() passed.");
    }
}
 
Example #5
Source File: Bug8040211.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static void test_filter() {
    boolean error = false;

    String ranges = "mtm-RU, en-gb-oed";
    String tags = "de-DE, en, mtm-RU, ymt-RU, en-gb-oxendict, ja-JP";
    FilteringMode mode = EXTENDED_FILTERING;

    List<LanguageRange> priorityList = LanguageRange.parse(ranges);
    List<Locale> tagList = generateLocales(tags);
    String actualLocales
            = showLocales(Locale.filter(priorityList, tagList, mode));
    String expectedLocales = "mtm-RU, ymt-RU, en-GB-oxendict";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#1 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    ranges = "phr-*-IN, ja-JP";
    tags = "en, pmu-Guru-IN, ja-Latn-JP, iw";
    mode = EXTENDED_FILTERING;

    priorityList = LanguageRange.parse(ranges);
    tagList = generateLocales(tags);
    actualLocales = showLocales(Locale.filter(priorityList, tagList, mode));
    expectedLocales = "pmu-Guru-IN, ja-Latn-JP";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#2 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    if (error) {
        err = true;
        System.out.println("  test_filter() failed.");
    } else {
        System.out.println("  test_filter() passed.");
    }
}
 
Example #6
Source File: Bug8040211.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static void test_filter() {
    boolean error = false;

    String ranges = "mtm-RU, en-gb-oed, coy, ar-HY";
    String tags = "de-DE, en, mtm-RU, ymt-RU, en-gb-oxendict, ja-JP, pij, nts, ar-arevela";
    FilteringMode mode = EXTENDED_FILTERING;

    List<LanguageRange> priorityList = LanguageRange.parse(ranges);
    List<Locale> tagList = generateLocales(tags);
    String actualLocales
            = showLocales(Locale.filter(priorityList, tagList, mode));
    String expectedLocales = "mtm-RU, ymt-RU, en-GB-oxendict, nts, pij";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#1 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    ranges = "phr-*-IN, ja-JP";
    tags = "en, pmu-Guru-IN, ja-Latn-JP, iw";
    mode = EXTENDED_FILTERING;

    priorityList = LanguageRange.parse(ranges);
    tagList = generateLocales(tags);
    actualLocales = showLocales(Locale.filter(priorityList, tagList, mode));
    expectedLocales = "pmu-Guru-IN, ja-Latn-JP";

    if (!expectedLocales.equals(actualLocales)) {
        error = true;
        showErrorMessage("#2 filter(" + mode + ")",
                ranges, tags, expectedLocales, actualLocales);
    }

    if (error) {
        err = true;
        System.out.println("  test_filter() failed.");
    } else {
        System.out.println("  test_filter() passed.");
    }
}