java.util.Locale#JAPAN源码实例Demo

下面列出了java.util.Locale#JAPAN 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u-dev-jdk   文件: TCKLocalizedPrinterParser.java
@DataProvider(name="time")
    Object[][] data_time() {
        return new Object[][] {
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.UK},
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.US},
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.FRANCE},
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.JAPAN},

                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.UK},
                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.US},
                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.FRANCE},
                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.JAPAN},

                // these localized patterns include "z" which isn't available from LocalTime
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.UK},
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.US},
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.FRANCE},
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.JAPAN},
//
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.UK},
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.US},
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.FRANCE},
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.JAPAN},
        };
    }
 
源代码2 项目: jdk8u-dev-jdk   文件: TCKLocalizedPrinterParser.java
@DataProvider(name="date")
Object[][] data_date() {
    return new Object[][] {
            {LocalDate.of(2012, 6, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.UK},
            {LocalDate.of(2012, 6, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.US},
            {LocalDate.of(2012, 6, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.FRANCE},
            {LocalDate.of(2012, 6, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.JAPAN},

            {LocalDate.of(2012, 6, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.UK},
            {LocalDate.of(2012, 6, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.US},
            {LocalDate.of(2012, 6, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.FRANCE},
            {LocalDate.of(2012, 6, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.JAPAN},

            {LocalDate.of(2012, 6, 30), FormatStyle.LONG, DateFormat.LONG, Locale.UK},
            {LocalDate.of(2012, 6, 30), FormatStyle.LONG, DateFormat.LONG, Locale.US},
            {LocalDate.of(2012, 6, 30), FormatStyle.LONG, DateFormat.LONG, Locale.FRANCE},
            {LocalDate.of(2012, 6, 30), FormatStyle.LONG, DateFormat.LONG, Locale.JAPAN},

            {LocalDate.of(2012, 6, 30), FormatStyle.FULL, DateFormat.FULL, Locale.UK},
            {LocalDate.of(2012, 6, 30), FormatStyle.FULL, DateFormat.FULL, Locale.US},
            {LocalDate.of(2012, 6, 30), FormatStyle.FULL, DateFormat.FULL, Locale.FRANCE},
            {LocalDate.of(2012, 6, 30), FormatStyle.FULL, DateFormat.FULL, Locale.JAPAN},
    };
}
 
@DataProvider(name="time")
    Object[][] data_time() {
        return new Object[][] {
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.UK},
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.US},
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.FRANCE},
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.JAPAN},

                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.UK},
                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.US},
                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.FRANCE},
                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.JAPAN},

                // these localized patterns include "z" which isn't available from LocalTime
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.UK},
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.US},
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.FRANCE},
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.JAPAN},
//
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.UK},
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.US},
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.FRANCE},
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.JAPAN},
        };
    }
 
源代码4 项目: jdk8u-jdk   文件: TCKLocalizedPrinterParser.java
@DataProvider(name="time")
    Object[][] data_time() {
        return new Object[][] {
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.UK},
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.US},
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.FRANCE},
                {LocalTime.of(11, 30), FormatStyle.SHORT, DateFormat.SHORT, Locale.JAPAN},

                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.UK},
                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.US},
                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.FRANCE},
                {LocalTime.of(11, 30), FormatStyle.MEDIUM, DateFormat.MEDIUM, Locale.JAPAN},

                // these localized patterns include "z" which isn't available from LocalTime
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.UK},
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.US},
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.FRANCE},
//                {LocalTime.of(11, 30), FormatStyle.LONG, DateFormat.LONG, Locale.JAPAN},
//
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.UK},
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.US},
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.FRANCE},
//                {LocalTime.of(11, 30), FormatStyle.FULL, DateFormat.FULL, Locale.JAPAN},
        };
    }
 
@Test
public void testGetDataList() throws Exception {
    //given
    int firstRow = 0;
    int numRows = 10;
    int totalCount = 1;
    List<POSubscription> expectedList = prepareList();
    Response resp = new Response(expectedList);
    when(subscriptionsService.getMySubscriptionsWithFiltering(any(PaginationFullTextFilter.class))).thenReturn(resp);
    when(subscriptionsService.getMySubscriptionsSizeWithFiltering(any(PaginationFullTextFilter.class))).thenReturn(totalCount);
    ArrangeableState arrangeable = new ArrangeableState() {
        @Override
        public List<FilterField> getFilterFields() {
            return Collections.emptyList();
        }

        @Override
        public List<SortField> getSortFields() {
            return Collections.emptyList();
        }

        @Override
        public Locale getLocale() {
            return Locale.JAPAN;
        }
    };
    when(model.getArrangeable()).thenReturn(arrangeable);
    model.setSelectedSubscription(new POSubscription(new VOSubscription()));

    //when
    List<POSubscription> result = model.getDataList(firstRow, numRows,
            Collections.<FilterField>emptyList(), Collections.<SortField>emptyList(), new Object());
    //then
    assertArrayEquals(expectedList.toArray(), result.toArray());
    assertEquals(model.getTotalCount(), totalCount);
}
 
源代码6 项目: j2objc   文件: DateFormatMiscTests.java
@Test
public void Test4117335() {
    final String bc = "\u7D00\u5143\u524D";
    final String ad = "\u897f\u66a6";
    final String jstLong = "\u65e5\u672c\u6a19\u6e96\u6642";
    final String jdtLong = "\u65e5\u672c\u590f\u6642\u9593";
    final String jstShort = "JST";
    final String jdtShort = "JDT";
    final String tzID = "Asia/Tokyo";

    DateFormatSymbols symbols = new DateFormatSymbols(Locale.JAPAN);
    final String[] eras = symbols.getEraNames();

    assertEquals("BC =", bc, eras[0]);
    assertEquals("AD =", ad, eras[1]);

    // don't use hard-coded index!
    final String zones[][] = symbols.getZoneStrings();
    int index = -1;
    for (int i = 0; i < zones.length; ++i) {
        if (tzID.equals(zones[i][0])) {
            index = i;
            break;
        }
    }

    if (index == -1) {
        errln("could not find " + tzID);
    } else {
        assertEquals("Long zone name = ", jstLong, zones[index][1]);
        assertEquals("Short zone name = ", jstShort, zones[index][2]);
        assertEquals("Long zone name (3) = ", jdtLong, zones[index][3]);
        assertEquals("Short zone name (4) = ", jdtShort, zones[index][4]);
    }
}
 
@Test
public void testGetDataListFilteredOut() throws Exception {
    //given
    int firstRow = 0;
    int numRows = 10;
    int totalCount = 1;
    List<POSubscription> expectedList = prepareList();
    Response resp = new Response(expectedList);
    when(subscriptionsService.getMySubscriptionsWithFiltering(any(PaginationFullTextFilter.class))).thenReturn(resp);
    when(subscriptionsService.getMySubscriptionsSizeWithFiltering(any(PaginationFullTextFilter.class))).thenReturn(totalCount);
    ArrangeableState arrangeable = new ArrangeableState() {
        @Override
        public List<FilterField> getFilterFields() {
            return Collections.emptyList();
        }

        @Override
        public List<SortField> getSortFields() {
            return Collections.emptyList();
        }

        @Override
        public Locale getLocale() {
            return Locale.JAPAN;
        }
    };
    when(model.getArrangeable()).thenReturn(arrangeable);
    VOSubscription voSubscription = new VOSubscription();
    voSubscription.setKey(1001L);
    model.setSelectedSubscription(new POSubscription(voSubscription));

    //when
    List<POSubscription> result = model.getDataList(firstRow, numRows,
            Collections.<FilterField>emptyList(), Collections.<SortField>emptyList(), new Object());
    //then
    assertArrayEquals(expectedList.toArray(), result.toArray());
    assertEquals(model.getTotalCount(), totalCount);
}
 
源代码8 项目: openjdk-8-source   文件: TestChronoField.java
@DataProvider(name = "localeList")
Locale[] data_localeList() {
    return new Locale[] {
            Locale.US,
            Locale.GERMAN,
            Locale.JAPAN,
            Locale.ROOT,
    };
}
 
源代码9 项目: TencentKona-8   文件: Util.java
/**
 *
 **/
public static void writeProlog (PrintWriter stream, String filename)
{
  // <d59355> Remove target directory
  String targetDir = ((Arguments)Compile.compiler.arguments).targetDir;
  if (targetDir != null)
    filename = filename.substring (targetDir.length ());
  stream.println ();
  stream.println ("/**");
  stream.println ("* " + filename.replace (File.separatorChar, '/') +
      " .");
  stream.println ("* " + Util.getMessage ("toJavaProlog1",
      Util.getMessage ("Version.product", Util.getMessage ("Version.number"))));
  // <d48911> Do not introduce invalid escape characters into comment! <daz>
  //stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file));
  stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file.replace (File.separatorChar, '/')));

  ///////////////
  // This SHOULD work, but there's a bug in the JDK.
  //    stream.println ("* " + DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ()).format (new Date ()));
  // This gets around the bug:

  DateFormat formatter = DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ());

  // Japanese-specific workaround.  JDK bug 4069784 being repaired by JavaSoft.
  // Keep this transient solution until bug fix is reported.cd .

  if (Locale.getDefault () == Locale.JAPAN)
    formatter.setTimeZone (java.util.TimeZone.getTimeZone ("JST"));
  else
    formatter.setTimeZone (java.util.TimeZone.getDefault ());

  stream.println ("* " + formatter.format (new Date ()));

  // <daz>
  ///////////////

  stream.println ("*/");
  stream.println ();
}
 
源代码10 项目: development   文件: BPLazyDataModelTest.java
@Test
public void testGetTotalCount() throws Exception {
    //given
    beanUnderTheTest.setTotalCount(-1);
    when(subscriptionsService.getSubscriptionsAndCustomersForManagersSize(any(Pagination.class))).thenReturn(2);
    beanUnderTheTest.setSubscriptionsService(subscriptionsService);
    ArrangeableState arrangeable = new ArrangeableState() {
        @Override
        public List<FilterField> getFilterFields() {
            return Collections.emptyList();
        }

        @Override
        public List<SortField> getSortFields() {
            return Collections.emptyList();
        }

        @Override
        public Locale getLocale() {
            return Locale.JAPAN;
        }
    };
    when(beanUnderTheTest.getArrangeable()).thenReturn(arrangeable);
    doNothing().when(beanUnderTheTest).applyFilters(anyList(), any(Pagination.class));
    //when
    int totalCount = beanUnderTheTest.getTotalCount();
    //then
    assertEquals(2, totalCount);
    verify(subscriptionsService, atLeastOnce()).getSubscriptionsAndCustomersForManagersSize(any(Pagination.class));
}
 
@Test
public void testGetRowTotalCount() throws Exception {
    //given
    int totalCount = 1;
    List<POSubscription> expectedList = prepareList();
    Response resp = new Response(expectedList);
    when(subscriptionsService.getMySubscriptionsWithFiltering(any(PaginationFullTextFilter.class))).thenReturn(resp);
    when(subscriptionsService.getMySubscriptionsSizeWithFiltering(any(PaginationFullTextFilter.class))).thenReturn(totalCount);
    ArrangeableState arrangeable = new ArrangeableState() {
        @Override
        public List<FilterField> getFilterFields() {
            return Collections.emptyList();
        }

        @Override
        public List<SortField> getSortFields() {
            return Collections.emptyList();
        }

        @Override
        public Locale getLocale() {
            return Locale.JAPAN;
        }
    };
    when(model.getArrangeable()).thenReturn(arrangeable);
    model.setSelectedSubscription(new POSubscription(new VOSubscription()));

    //when
    int result = model.getTotalCount();
    //then
    assertEquals(result, totalCount);
}
 
源代码12 项目: openjdk-jdk8u-backup   文件: Util.java
/**
 *
 **/
public static void writeProlog (PrintWriter stream, String filename)
{
  // <d59355> Remove target directory
  String targetDir = ((Arguments)Compile.compiler.arguments).targetDir;
  if (targetDir != null)
    filename = filename.substring (targetDir.length ());
  stream.println ();
  stream.println ("/**");
  stream.println ("* " + filename.replace (File.separatorChar, '/') +
      " .");
  stream.println ("* " + Util.getMessage ("toJavaProlog1",
      Util.getMessage ("Version.product", Util.getMessage ("Version.number"))));
  // <d48911> Do not introduce invalid escape characters into comment! <daz>
  //stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file));
  stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file.replace (File.separatorChar, '/')));

  ///////////////
  // This SHOULD work, but there's a bug in the JDK.
  //    stream.println ("* " + DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ()).format (new Date ()));
  // This gets around the bug:

  DateFormat formatter = DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ());

  // Japanese-specific workaround.  JDK bug 4069784 being repaired by JavaSoft.
  // Keep this transient solution until bug fix is reported.cd .

  if (Locale.getDefault () == Locale.JAPAN)
    formatter.setTimeZone (java.util.TimeZone.getTimeZone ("JST"));
  else
    formatter.setTimeZone (java.util.TimeZone.getDefault ());

  stream.println ("* " + formatter.format (new Date ()));

  // <daz>
  ///////////////

  stream.println ("*/");
  stream.println ();
}
 
源代码13 项目: development   文件: BPLazyDataModelTest.java
@Test
public void testGetDataList() throws Exception {
    //given
    int firstRow = 0;
    int numRows = 10;
    int totalCount = 1;
    List<POSubscriptionAndCustomer> expectedList = prepareList();
    Response resp = new Response(expectedList);
    when(subscriptionsService.getSubscriptionsAndCustomersForManagers(any(Pagination.class))).thenReturn(resp);
    when(subscriptionsService.getSubscriptionsAndCustomersForManagersSize(any(Pagination.class))).thenReturn(totalCount);
    ArrangeableState arrangeable = new ArrangeableState() {
        @Override
        public List<FilterField> getFilterFields() {
            return Collections.emptyList();
        }

        @Override
        public List<SortField> getSortFields() {
            return Collections.emptyList();
        }

        @Override
        public Locale getLocale() {
            return Locale.JAPAN;
        }
    };
    when(beanUnderTheTest.getArrangeable()).thenReturn(arrangeable);
    doNothing().when(beanUnderTheTest).applyFilters(anyList(), any(Pagination.class));
    doNothing().when(beanUnderTheTest).decorateWithLocalizedStatuses(any(Pagination.class));
    beanUnderTheTest.setSubscriptionsService(subscriptionsService);

    //when
    List<POSubscriptionAndCustomer> result = beanUnderTheTest.getDataList(firstRow, numRows,
            Collections.<FilterField>emptyList(), Collections.<SortField>emptyList(), new Object());
    //then
    assertArrayEquals(expectedList.toArray(), result.toArray());
    assertEquals(beanUnderTheTest.getTotalCount(), totalCount);
}
 
源代码14 项目: dragonwell8_jdk   文件: CurrencyFormat.java
static void testFormatting() {
    boolean failed = false;
    Locale[] locales = {
        Locale.US,
        Locale.JAPAN,
        Locale.GERMANY,
        Locale.ITALY,
        new Locale("it", "IT", "EURO") };
    Currency[] currencies = {
        null,
        Currency.getInstance("USD"),
        Currency.getInstance("JPY"),
        Currency.getInstance("DEM"),
        Currency.getInstance("EUR"),
    };
    String[][] expecteds = {
        {"$1,234.56", "$1,234.56", "JPY1,235", "DEM1,234.56", "EUR1,234.56"},
        {"\uFFE51,235", "USD1,234.56", "\uFFE51,235", "DEM1,234.56", "EUR1,234.56"},
        {"1.234,56 \u20AC", "1.234,56 USD", "1.235 JPY", "1.234,56 DM", "1.234,56 \u20AC"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
    };

    for (int i = 0; i < locales.length; i++) {
        Locale locale = locales[i];
        NumberFormat format = NumberFormat.getCurrencyInstance(locale);
        for (int j = 0; j < currencies.length; j++) {
            Currency currency = currencies[j];
            String expected = expecteds[i][j];
            if (currency != null) {
                format.setCurrency(currency);
                int digits = currency.getDefaultFractionDigits();
                format.setMinimumFractionDigits(digits);
                format.setMaximumFractionDigits(digits);
            }
            String result = format.format(1234.56);
            if (!result.equals(expected)) {
                failed = true;
                System.out.println("FAIL: Locale " + locale
                    + (currency == null ? ", default currency" : (", currency: " + currency))
                    + ", expected: " + expected
                    + ", actual: " + result);
            }
        }
    }

    if (failed) {
        throw new RuntimeException();
    }
}
 
源代码15 项目: openjdk-jdk9   文件: CurrencyFormat.java
static void testFormatting() {
    boolean failed = false;
    Locale[] locales = {
        Locale.US,
        Locale.JAPAN,
        Locale.GERMANY,
        Locale.ITALY,
        new Locale("it", "IT", "EURO") };
    Currency[] currencies = {
        null,
        Currency.getInstance("USD"),
        Currency.getInstance("JPY"),
        Currency.getInstance("DEM"),
        Currency.getInstance("EUR"),
    };
    String[][] expecteds = {
        {"$1,234.56", "$1,234.56", "JPY1,235", "DEM1,234.56", "EUR1,234.56"},
        {"\uFFE51,235", "USD1,234.56", "\uFFE51,235", "DEM1,234.56", "EUR1,234.56"},
        {"1.234,56 \u20AC", "1.234,56 USD", "1.235 JPY", "1.234,56 DM", "1.234,56 \u20AC"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
    };

    for (int i = 0; i < locales.length; i++) {
        Locale locale = locales[i];
        NumberFormat format = NumberFormat.getCurrencyInstance(locale);
        for (int j = 0; j < currencies.length; j++) {
            Currency currency = currencies[j];
            String expected = expecteds[i][j];
            if (currency != null) {
                format.setCurrency(currency);
                int digits = currency.getDefaultFractionDigits();
                format.setMinimumFractionDigits(digits);
                format.setMaximumFractionDigits(digits);
            }
            String result = format.format(1234.56);
            if (!result.equals(expected)) {
                failed = true;
                System.out.println("FAIL: Locale " + locale
                    + (currency == null ? ", default currency" : (", currency: " + currency))
                    + ", expected: " + expected
                    + ", actual: " + result);
            }
        }
    }

    if (failed) {
        throw new RuntimeException();
    }
}
 
源代码16 项目: jdk8u_jdk   文件: TestEraDisplayName.java
@DataProvider(name="eraDisplayName")
Object[][] eraDisplayName() {
    return new Object[][] {
        // Era, text style, displyay locale, expected name
        // IsoEra
        { IsoEra.BCE,   TextStyle.FULL,     Locale.US,      "Before Christ" },
        { IsoEra.CE,    TextStyle.FULL,     Locale.US,      "Anno Domini" },
        { IsoEra.BCE,   TextStyle.FULL,     Locale.JAPAN,   "\u7d00\u5143\u524d" },
        { IsoEra.CE,    TextStyle.FULL,     Locale.JAPAN,   "\u897f\u66a6" },
        { IsoEra.BCE,   TextStyle.SHORT,    Locale.US,      "BC" },
        { IsoEra.CE,    TextStyle.SHORT,    Locale.US,      "AD" },
        { IsoEra.BCE,   TextStyle.SHORT,    Locale.JAPAN,   "\u7d00\u5143\u524d" },
        { IsoEra.CE,    TextStyle.SHORT,    Locale.JAPAN,   "\u897f\u66a6" },
        { IsoEra.BCE,   TextStyle.NARROW,   Locale.US,      "B" },
        { IsoEra.CE,    TextStyle.NARROW,   Locale.US,      "A" },
        { IsoEra.BCE,   TextStyle.NARROW,   Locale.JAPAN,   "B" },
        { IsoEra.CE,    TextStyle.NARROW,   Locale.JAPAN,   "A" },

        // JapaneseEra
        { JapaneseEra.MEIJI,    TextStyle.FULL,     Locale.US,      "Meiji" },
        { JapaneseEra.TAISHO,   TextStyle.FULL,     Locale.US,      "Taisho" },
        { JapaneseEra.SHOWA,    TextStyle.FULL,     Locale.US,      "Showa" },
        { JapaneseEra.HEISEI,   TextStyle.FULL,     Locale.US,      "Heisei" },
        { JapaneseEra.MEIJI,    TextStyle.FULL,     Locale.JAPAN,   "\u660e\u6cbb" },
        { JapaneseEra.TAISHO,   TextStyle.FULL,     Locale.JAPAN,   "\u5927\u6b63" },
        { JapaneseEra.SHOWA,    TextStyle.FULL,     Locale.JAPAN,   "\u662d\u548c" },
        { JapaneseEra.HEISEI,   TextStyle.FULL,     Locale.JAPAN,   "\u5e73\u6210" },
        { JapaneseEra.MEIJI,    TextStyle.SHORT,    Locale.US,      "Meiji" },
        { JapaneseEra.TAISHO,   TextStyle.SHORT,    Locale.US,      "Taisho" },
        { JapaneseEra.SHOWA,    TextStyle.SHORT,    Locale.US,      "Showa" },
        { JapaneseEra.HEISEI,   TextStyle.SHORT,    Locale.US,      "Heisei" },
        { JapaneseEra.MEIJI,    TextStyle.SHORT,    Locale.JAPAN,   "\u660e\u6cbb" },
        { JapaneseEra.TAISHO,   TextStyle.SHORT,    Locale.JAPAN,   "\u5927\u6b63" },
        { JapaneseEra.SHOWA,    TextStyle.SHORT,    Locale.JAPAN,   "\u662d\u548c" },
        { JapaneseEra.HEISEI,   TextStyle.SHORT,    Locale.JAPAN,   "\u5e73\u6210" },
        { JapaneseEra.MEIJI,    TextStyle.NARROW,   Locale.US,      "M" },
        { JapaneseEra.TAISHO,   TextStyle.NARROW,   Locale.US,      "T" },
        { JapaneseEra.SHOWA,    TextStyle.NARROW,   Locale.US,      "S" },
        { JapaneseEra.HEISEI,   TextStyle.NARROW,   Locale.US,      "H" },
        { JapaneseEra.MEIJI,    TextStyle.NARROW,   Locale.JAPAN,   "M" },
        { JapaneseEra.TAISHO,   TextStyle.NARROW,   Locale.JAPAN,   "T" },
        { JapaneseEra.SHOWA,    TextStyle.NARROW,   Locale.JAPAN,   "S" },
        { JapaneseEra.HEISEI,   TextStyle.NARROW,   Locale.JAPAN,   "H" },
    };
}
 
源代码17 项目: TencentKona-8   文件: TestEraDisplayName.java
@DataProvider(name="eraDisplayName")
Object[][] eraDisplayName() {
    return new Object[][] {
        // Era, text style, displyay locale, expected name
        // IsoEra
        { IsoEra.BCE,   TextStyle.FULL,     Locale.US,      "Before Christ" },
        { IsoEra.CE,    TextStyle.FULL,     Locale.US,      "Anno Domini" },
        { IsoEra.BCE,   TextStyle.FULL,     Locale.JAPAN,   "\u7d00\u5143\u524d" },
        { IsoEra.CE,    TextStyle.FULL,     Locale.JAPAN,   "\u897f\u66a6" },
        { IsoEra.BCE,   TextStyle.SHORT,    Locale.US,      "BC" },
        { IsoEra.CE,    TextStyle.SHORT,    Locale.US,      "AD" },
        { IsoEra.BCE,   TextStyle.SHORT,    Locale.JAPAN,   "\u7d00\u5143\u524d" },
        { IsoEra.CE,    TextStyle.SHORT,    Locale.JAPAN,   "\u897f\u66a6" },
        { IsoEra.BCE,   TextStyle.NARROW,   Locale.US,      "B" },
        { IsoEra.CE,    TextStyle.NARROW,   Locale.US,      "A" },
        { IsoEra.BCE,   TextStyle.NARROW,   Locale.JAPAN,   "B" },
        { IsoEra.CE,    TextStyle.NARROW,   Locale.JAPAN,   "A" },

        // JapaneseEra
        { JapaneseEra.MEIJI,    TextStyle.FULL,     Locale.US,      "Meiji" },
        { JapaneseEra.TAISHO,   TextStyle.FULL,     Locale.US,      "Taisho" },
        { JapaneseEra.SHOWA,    TextStyle.FULL,     Locale.US,      "Showa" },
        { JapaneseEra.HEISEI,   TextStyle.FULL,     Locale.US,      "Heisei" },
        { JapaneseEra.MEIJI,    TextStyle.FULL,     Locale.JAPAN,   "\u660e\u6cbb" },
        { JapaneseEra.TAISHO,   TextStyle.FULL,     Locale.JAPAN,   "\u5927\u6b63" },
        { JapaneseEra.SHOWA,    TextStyle.FULL,     Locale.JAPAN,   "\u662d\u548c" },
        { JapaneseEra.HEISEI,   TextStyle.FULL,     Locale.JAPAN,   "\u5e73\u6210" },
        { JapaneseEra.MEIJI,    TextStyle.SHORT,    Locale.US,      "Meiji" },
        { JapaneseEra.TAISHO,   TextStyle.SHORT,    Locale.US,      "Taisho" },
        { JapaneseEra.SHOWA,    TextStyle.SHORT,    Locale.US,      "Showa" },
        { JapaneseEra.HEISEI,   TextStyle.SHORT,    Locale.US,      "Heisei" },
        { JapaneseEra.MEIJI,    TextStyle.SHORT,    Locale.JAPAN,   "\u660e\u6cbb" },
        { JapaneseEra.TAISHO,   TextStyle.SHORT,    Locale.JAPAN,   "\u5927\u6b63" },
        { JapaneseEra.SHOWA,    TextStyle.SHORT,    Locale.JAPAN,   "\u662d\u548c" },
        { JapaneseEra.HEISEI,   TextStyle.SHORT,    Locale.JAPAN,   "\u5e73\u6210" },
        { JapaneseEra.MEIJI,    TextStyle.NARROW,   Locale.US,      "M" },
        { JapaneseEra.TAISHO,   TextStyle.NARROW,   Locale.US,      "T" },
        { JapaneseEra.SHOWA,    TextStyle.NARROW,   Locale.US,      "S" },
        { JapaneseEra.HEISEI,   TextStyle.NARROW,   Locale.US,      "H" },
        { JapaneseEra.MEIJI,    TextStyle.NARROW,   Locale.JAPAN,   "M" },
        { JapaneseEra.TAISHO,   TextStyle.NARROW,   Locale.JAPAN,   "T" },
        { JapaneseEra.SHOWA,    TextStyle.NARROW,   Locale.JAPAN,   "S" },
        { JapaneseEra.HEISEI,   TextStyle.NARROW,   Locale.JAPAN,   "H" },
    };
}
 
源代码18 项目: TencentKona-8   文件: bug4117335.java
public static void main(String[] args) throws Exception
{
    DateFormatSymbols symbols = new DateFormatSymbols(Locale.JAPAN);
    String[] eras = symbols.getEras();
    System.out.println("BC = " + eras[0]);
    if (!eras[0].equals(bc)) {
        System.out.println("*** Should have been " + bc);
        throw new Exception("Error in BC");
    }
    System.out.println("AD = " + eras[1]);
    if (!eras[1].equals(ad)) {
        System.out.println("*** Should have been " + ad);
        throw new Exception("Error in AD");
    }
    String[][] zones = symbols.getZoneStrings();
    for (int i = 0; i < zones.length; i++) {
        if (!"Asia/Tokyo".equals(zones[i][0])) {
            continue;
        }
        System.out.println("Long zone name = " + zones[i][1]);
        if (!zones[i][1].equals(jstLong)) {
            System.out.println("*** Should have been " + jstLong);
            throw new Exception("Error in long TZ name");
        }
        System.out.println("Short zone name = " + zones[i][2]);
        if (!zones[i][2].equals(jstShort)) {
            System.out.println("*** Should have been " + jstShort);
            throw new Exception("Error in short TZ name");
        }
        System.out.println("Long zone name = " + zones[i][3]);
        if (!zones[i][3].equals(jdtLong)) {
            System.out.println("*** Should have been " + jdtLong);
            throw new Exception("Error in long TZ name");
        }
        System.out.println("SHORT zone name = " + zones[i][4]);
        if (!zones[i][4].equals(jdtShort)) {
            System.out.println("*** Should have been " + jdtShort);
            throw new Exception("Error in short TZ name");
        }
    }
}
 
源代码19 项目: FirefoxReality   文件: JapaneseKeyboard.java
@Override
public Locale getLocale() {
    return Locale.JAPAN;
}
 
源代码20 项目: openjdk-jdk9   文件: bug4117335.java
public static void main(String[] args) throws Exception
{
    DateFormatSymbols symbols = new DateFormatSymbols(Locale.JAPAN);
    String[] eras = symbols.getEras();
    System.out.println("BC = " + eras[0]);
    if (!eras[0].equals(bc)) {
        System.out.println("*** Should have been " + bc);
        throw new Exception("Error in BC");
    }
    System.out.println("AD = " + eras[1]);
    if (!eras[1].equals(ad)) {
        System.out.println("*** Should have been " + ad);
        throw new Exception("Error in AD");
    }
    String[][] zones = symbols.getZoneStrings();
    for (int i = 0; i < zones.length; i++) {
        if (!"Asia/Tokyo".equals(zones[i][0])) {
            continue;
        }
        System.out.println("Long zone name = " + zones[i][1]);
        if (!zones[i][1].equals(jstLong)) {
            System.out.println("*** Should have been " + jstLong);
            throw new Exception("Error in long TZ name");
        }
        System.out.println("Short zone name = " + zones[i][2]);
        if (!zones[i][2].equals(jstShort)) {
            System.out.println("*** Should have been " + jstShort);
            throw new Exception("Error in short TZ name");
        }
        System.out.println("Long zone name = " + zones[i][3]);
        if (!zones[i][3].equals(jdtLong)) {
            System.out.println("*** Should have been " + jdtLong);
            throw new Exception("Error in long TZ name");
        }
        System.out.println("SHORT zone name = " + zones[i][4]);
        if (!zones[i][4].equals(jdtShort)) {
            System.out.println("*** Should have been " + jdtShort);
            throw new Exception("Error in short TZ name");
        }
    }
}