Java Code Examples for java.time.format.TextStyle#SHORT_STANDALONE

The following examples show how to use java.time.format.TextStyle#SHORT_STANDALONE . 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: ExtraDateStrings.java    From LGoodDatePicker with MIT License 6 votes vote down vote up
/**
 * getStandaloneMonthName, This returns a "standalone version" month name for the specified
 * month, in the specified locale. In some languages, including Russian and Czech, the
 * standalone version of the month name is different from the version of the month name you
 * would use as part of a full date. (Is different from the formatting version).
 *
 * This tries to get the standalone version first. If no mapping is found for a standalone
 * version (Presumably because the supplied language has no standalone version), then this will
 * return the formatting version of the month name.
 */
private static String getStandaloneMonthName(Month month, Locale locale, boolean capitalize,
        boolean shortVersion) {
    // Attempt to get the standalone version of the month name.
    TextStyle style = (shortVersion) ? TextStyle.SHORT_STANDALONE : TextStyle.FULL_STANDALONE;
    String monthName = month.getDisplayName(style, locale);
    String monthNumber = "" + month.getValue();
    // If no mapping was found, then get the "formatting version" of the month name.
    if (monthName.equals(monthNumber)) {
        DateFormatSymbols dateSymbols = DateFormatSymbols.getInstance(locale);
        if (shortVersion) {
            monthName = dateSymbols.getShortMonths()[month.getValue() - 1];
        } else {
            monthName = dateSymbols.getMonths()[month.getValue() - 1];
        }
    }
    // If needed, capitalize the month name.
    if ((capitalize) && (monthName != null) && (monthName.length() > 0)) {
        monthName = monthName.substring(0, 1).toUpperCase(locale) + monthName.substring(1);
    }
    return monthName;
}
 
Example 2
Source File: TestTextPrinterWithLocale.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="print_standalone")
Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u044f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u044f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}
 
Example 3
Source File: TestTextPrinter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="print_standalone")
Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u042f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}
 
Example 4
Source File: TestTextParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="parseStandaloneText")
Object[][] providerStandaloneText() {
    // Locale, TemporalField, TextStyle, expected value, input text
    return new Object[][] {
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u042f\u043d\u0432."},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0414\u0435\u043a."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
    };
}
 
Example 5
Source File: TestTextPrinter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="print_standalone")
Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u042f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}
 
Example 6
Source File: TestTextParser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="parseStandaloneText")
Object[][] providerStandaloneText() {
    // Locale, TemporalField, TextStyle, expected value, input text
    return new Object[][] {
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u042f\u043d\u0432."},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0414\u0435\u043a."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
    };
}
 
Example 7
Source File: TestTextPrinter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="print_standalone")
Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u042f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}
 
Example 8
Source File: TestTextParser.java    From j2objc with Apache License 2.0 5 votes vote down vote up
@DataProvider
public static Object[][] providerStandaloneText() {
    // Locale, TemporalField, TextStyle, expected value, input text
    return new Object[][] {
        // Android-changed: CLDR provides russian days/months in lower-case and with a fullstop.
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u044f\u043d\u0432\u0430\u0440\u044c" },
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0434\u0435\u043a\u0430\u0431\u0440\u044c" },
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u044f\u043d\u0432." },
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0434\u0435\u043a." },
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
    };
}
 
Example 9
Source File: TestTextParser.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="parseStandaloneText")
Object[][] providerStandaloneText() {
    // Locale, TemporalField, TextStyle, expected value, input text
    return new Object[][] {
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u042f\u043d\u0432."},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0414\u0435\u043a."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
    };
}
 
Example 10
Source File: TestTextPrinter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="print_standalone")
Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u042f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}
 
Example 11
Source File: TestTextParserWithLocale.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="parseStandaloneText")
Object[][] providerStandaloneText() {
    // Locale, TemporalField, TextStyle, expected value, input text
    return new Object[][] {
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u044f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0434\u0435\u043a\u0430\u0431\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u044f\u043d\u0432."},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0434\u0435\u043a."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
    };
}
 
Example 12
Source File: TestTextParser.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="parseStandaloneText")
Object[][] providerStandaloneText() {
    // Locale, TemporalField, TextStyle, expected value, input text
    return new Object[][] {
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u042f\u043d\u0432."},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0414\u0435\u043a."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
    };
}
 
Example 13
Source File: TestTextPrinter.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="print_standalone")
Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u042f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}
 
Example 14
Source File: TestTextParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="parseStandaloneText")
Object[][] providerStandaloneText() {
    // Locale, TemporalField, TextStyle, expected value, input text
    return new Object[][] {
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u042f\u043d\u0432."},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0414\u0435\u043a."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
    };
}
 
Example 15
Source File: TestTextParser.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="parseStandaloneText")
Object[][] providerStandaloneText() {
    // Locale, TemporalField, TextStyle, expected value, input text
    return new Object[][] {
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u042f\u043d\u0432."},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0414\u0435\u043a."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
    };
}
 
Example 16
Source File: TestTextPrinter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="print_standalone")
Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u042f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}
 
Example 17
Source File: TestTextPrinter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="print_standalone")
Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u042f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}
 
Example 18
Source File: TestTextPrinter.java    From j2objc with Apache License 2.0 5 votes vote down vote up
@DataProvider
public static Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        // Android-changed: CLDR uses lower case for russian month names.
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u044f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u044f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}
 
Example 19
Source File: TestTextParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="parseStandaloneText")
Object[][] providerStandaloneText() {
    // Locale, TemporalField, TextStyle, expected value, input text
    return new Object[][] {
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,   1, "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  12, "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE,  1, "\u042f\u043d\u0432."},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0414\u0435\u043a."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,   2, "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE,  2, "ti"},
    };
}
 
Example 20
Source File: TestTextPrinter.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="print_standalone")
Object[][] provider_StandaloneNames() {
    return new Object[][] {
        // standalone names for 2013-01-01 (Tue)
        // Locale, TemporalField, TextStyle, expected text
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE,  "\u042f\u043d\u0432\u0430\u0440\u044c"},
        {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u042f\u043d\u0432."},
        {FINNISH, DAY_OF_WEEK,   TextStyle.FULL_STANDALONE,  "tiistai"},
        {FINNISH, DAY_OF_WEEK,   TextStyle.SHORT_STANDALONE, "ti"},
    };
}