當前位置: 首頁>>代碼示例>>Java>>正文


Java Locale.JAPAN屬性代碼示例

本文整理匯總了Java中java.util.Locale.JAPAN屬性的典型用法代碼示例。如果您正苦於以下問題:Java Locale.JAPAN屬性的具體用法?Java Locale.JAPAN怎麽用?Java Locale.JAPAN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.util.Locale的用法示例。


在下文中一共展示了Locale.JAPAN屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: switchLanguage

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);
    //*/
}
 
開發者ID:kamisakihideyoshi,項目名稱:TaipeiTechRefined,代碼行數:21,代碼來源:MainActivity.java

示例2: data_date

@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},
    };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:24,代碼來源:TCKLocalizedPrinterParser.java

示例3: data_time

@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},
        };
    }
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:25,代碼來源:TCKLocalizedPrinterParser.java

示例4: testGetDataList

@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);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:36,代碼來源:MySubscriptionsLazyDataModelTest.java

示例5: testGetDataListFilteredOut

@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);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:38,代碼來源:MySubscriptionsLazyDataModelTest.java

示例6: testGetDataListReturnsDetails

@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);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:37,代碼來源:MySubscriptionsLazyDataModelTest.java

示例7: testGetRowTotalCount

@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);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:32,代碼來源:MySubscriptionsLazyDataModelTest.java

示例8: testGetDataListNullSelected

@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());
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:40,代碼來源:MySubscriptionsLazyDataModelTest.java

示例9: testGetDataList

@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);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:38,代碼來源:BPLazyDataModelTest.java

示例10: testGetTotalCount

@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));
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:30,代碼來源:BPLazyDataModelTest.java

示例11: testGetSubscriptionsListSize

@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);
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:29,代碼來源:BPLazyDataModelTest.java

示例12: isSharedFlyweight

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;
}
 
開發者ID:luoyaogui,項目名稱:otter-G,代碼行數:33,代碼來源:ObjectProfiler.java

示例13: writeProlog

/**
 *
 **/
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 ();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:42,代碼來源:Util.java

示例14: data_localeList

@DataProvider(name = "localeList")
Locale[] data_localeList() {
    return new Locale[] {
            Locale.US,
            Locale.GERMAN,
            Locale.JAPAN,
            Locale.ROOT,
    };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:9,代碼來源:TestChronoField.java

示例15: testFormatting

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();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:50,代碼來源:CurrencyFormat.java


注:本文中的java.util.Locale.JAPAN屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。