Java Code Examples for java.util.Locale.getDisplayScript()

The following are Jave code examples for showing how to use getDisplayScript() of the java.util.Locale class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: jdk8u-jdk   File: LocaleCategory.java   View Source Code Vote up 6 votes
static void testBug7079486() {
    Locale zh_Hans_CN = Locale.forLanguageTag("zh-Hans-CN");

    // make sure JRE has zh_Hans_CN localized string
    if (zh_Hans_CN.getDisplayScript(Locale.US).equals(zh_Hans_CN.getDisplayScript(zh_Hans_CN))) {
        return;
    }

    Locale.setDefault(Locale.US);
    String en_script = zh_Hans_CN.getDisplayScript();

    Locale.setDefault(Locale.Category.DISPLAY, zh_Hans_CN);
    String zh_script = zh_Hans_CN.getDisplayScript();

    if (en_script.equals(zh_script)) {
        throw new RuntimeException("Locale.getDisplayScript() (no args) does not honor default DISPLAY locale");
    }
}
 
Example 2
Project: openjdk-jdk10   File: LocaleCategory.java   View Source Code Vote up 6 votes
static void testBug7079486() {
    Locale zh_Hans_CN = Locale.forLanguageTag("zh-Hans-CN");

    // make sure JRE has zh_Hans_CN localized string
    if (zh_Hans_CN.getDisplayScript(Locale.US).equals(zh_Hans_CN.getDisplayScript(zh_Hans_CN))) {
        return;
    }

    Locale.setDefault(Locale.US);
    String en_script = zh_Hans_CN.getDisplayScript();

    Locale.setDefault(Locale.Category.DISPLAY, zh_Hans_CN);
    String zh_script = zh_Hans_CN.getDisplayScript();

    if (en_script.equals(zh_script)) {
        throw new RuntimeException("Locale.getDisplayScript() (no args) does not honor default DISPLAY locale");
    }
}