Java Code Examples for java.util.Locale.JAPAN

The following are Jave code examples for showing how to use JAPAN 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: TaipeiTechRefined   File: MainActivity.java   View Source Code Vote up 6 votes
protected void switchLanguage(String lang) {
    Resources resources = getResources();
    Configuration configuration = resources.getConfiguration();
    DisplayMetrics displayMetrics = resources.getDisplayMetrics();
    switch (lang) {
        case "zh":
            configuration.locale = Locale.TAIWAN;
            break;
        case "ja":
            configuration.locale = Locale.JAPAN;
            break;
        default:
            configuration.locale = Locale.ENGLISH;
            break;
    }

    resources.updateConfiguration(configuration, displayMetrics);
    /*  避免重複寫入
    MainApplication.writeSetting("uiLang", lang);
    //*/
}
 
Example 2
Project: jdk8u-jdk   File: TCKLocalizedPrinterParser.java   View Source Code Vote up 6 votes
@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},
    };
}
 
Example 3
Project: jdk8u-jdk   File: TCKLocalizedPrinterParser.java   View Source Code Vote up 6 votes
@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},
        };
    }
 
Example 4
Project: openjdk-jdk10   File: TCKLocalizedPrinterParser.java   View Source Code Vote up 6 votes
@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},
    };
}
 
Example 5
Project: oscm   File: MySubscriptionsLazyDataModelTest.java   View Source Code Vote up 5 votes
@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);
}
 
Example 6
Project: oscm   File: MySubscriptionsLazyDataModelTest.java   View Source Code Vote up 5 votes
@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);
}
 
Example 7
Project: oscm   File: MySubscriptionsLazyDataModelTest.java   View Source Code Vote up 5 votes
@Test
public void testGetDataListReturnsDetails() 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);
    doReturn(expectedList.get(0)).when(subscriptionsService).getMySubscriptionDetails(expectedList.get(0).getKey());
    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);
}
 
Example 8
Project: oscm   File: MySubscriptionsLazyDataModelTest.java   View Source Code Vote up 5 votes
@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);
}
 
Example 9
Project: oscm   File: MySubscriptionsLazyDataModelTest.java   View Source Code Vote up 5 votes
@Test
public void testGetDataListNullSelected() throws Exception {
    //given
    int firstRow = 0;
    int numRows = 10;
    int totalCount = 1;
    List<POSubscription> expectedList = prepareList();
    Response resp = new Response(expectedList);
    POSubscription selectedSubscription = mock(POSubscription.class);
    when(selectedSubscription.getKey()).thenReturn(-1L);
    when(subscriptionsService.getMySubscriptionsWithFiltering(any(PaginationFullTextFilter.class))).thenReturn(resp);
    when(subscriptionsService.getMySubscriptionsSizeWithFiltering(any(PaginationFullTextFilter.class))).thenReturn(totalCount);
    when(subscriptionsService.getMySubscriptionDetails(-1L)).thenReturn(null);
    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);

    //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);
    assertNull(model.getSelectedSubscription());
    assertNull(model.getSelectedSubscriptionId());
}
 
Example 10
Project: oscm   File: BPLazyDataModelTest.java   View Source Code Vote up 5 votes
@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);
}
 
Example 11
Project: oscm   File: BPLazyDataModelTest.java   View Source Code Vote up 5 votes
@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));
}
 
Example 12
Project: oscm   File: BPLazyDataModelTest.java   View Source Code Vote up 5 votes
@Test
public void testGetSubscriptionsListSize() throws Exception {
    //given
    when(beanUnderTheTest.getCachedList()).thenReturn(prepareList());
    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(subscriptionsService.getSubscriptionsAndCustomersForManagersSize(any(Pagination.class))).thenReturn(1);
    beanUnderTheTest.setSubscriptionsService(subscriptionsService);
    //when
    int totalCount = beanUnderTheTest.getTotalCount();
    //then
    assertEquals(1,totalCount);
}
 
Example 13
Project: otter-G   File: ObjectProfiler.java   View Source Code Vote up 5 votes
private static boolean isSharedFlyweight(Object obj) {
    if (obj == null) {
        return true;
    }
    if (obj == Boolean.TRUE || obj == Boolean.FALSE) {
        return true;
    }
    if (/* obj == Locale.ROOT || *//* Java 6 */
    obj == Locale.ENGLISH || obj == Locale.FRENCH || obj == Locale.GERMAN || obj == Locale.ITALIAN
            || obj == Locale.JAPANESE || obj == Locale.KOREAN || obj == Locale.CHINESE
            || obj == Locale.SIMPLIFIED_CHINESE || obj == Locale.TRADITIONAL_CHINESE || obj == Locale.FRANCE
            || obj == Locale.GERMANY || obj == Locale.ITALY || obj == Locale.JAPAN || obj == Locale.KOREA
            || obj == Locale.CHINA || obj == Locale.PRC || obj == Locale.TAIWAN || obj == Locale.UK
            || obj == Locale.US || obj == Locale.CANADA || obj == Locale.CANADA_FRENCH) {
        return true;
    }
    if (obj == Collections.EMPTY_SET || obj == Collections.EMPTY_LIST || obj == Collections.EMPTY_MAP) {
        return true;
    }
    if (obj == BigInteger.ZERO || obj == BigInteger.ONE) {
        return true;
    }
    if (obj == System.in || obj == System.out || obj == System.err) {
        return true;
    }
    if (obj == String.CASE_INSENSITIVE_ORDER) {
        return true;
    }
    if (obj == JarFile.MANIFEST_NAME) {
        return true;
    }
    return false;
}
 
Example 14
Project: OpenJSharp   File: Util.java   View Source Code Vote up 5 votes
/**
 *
 **/
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 ();
}
 
Example 15
Project: jdk8u-jdk   File: TestChronoField.java   View Source Code Vote up 5 votes
@DataProvider(name = "localeList")
Locale[] data_localeList() {
    return new Locale[] {
            Locale.US,
            Locale.GERMAN,
            Locale.JAPAN,
            Locale.ROOT,
    };
}
 
Example 16
Project: openjdk-jdk10   File: Util.java   View Source Code Vote up 5 votes
/**
 *
 **/
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 ();
}
 
Example 17
Project: openjdk-jdk10   File: TCKLocalizedPrinterParser.java   View Source Code Vote up 5 votes
@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},
        };
    }
 
Example 18
Project: openjdk-jdk10   File: TestChronoField.java   View Source Code Vote up 5 votes
@DataProvider(name = "localeList")
Locale[] data_localeList() {
    return new Locale[] {
            Locale.US,
            Locale.GERMAN,
            Locale.JAPAN,
            Locale.ROOT,
    };
}
 
Example 19
Project: openjdk-jdk10   File: CurrencyFormat.java   View Source Code Vote up 4 votes
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();
    }
}
 
Example 20
Project: openjdk-jdk10   File: MyResourcesAsia.java   View Source Code Vote up 4 votes
public MyResourcesAsia() {
    super("java.properties", "asia",
          Locale.JAPANESE, Locale.JAPAN, Locale.CHINESE, Locale.TAIWAN,
          new Locale("vi"));
}