private void initSupportedLocales()
    {
        supportedLocales = new UserLocale[12];
        defaultAppLocale = new UserLocale(Locale.ENGLISH.getLanguage(), null, "English");
        supportedLocales[0] = defaultAppLocale;
        supportedLocales[1] = new UserLocale(Locale.FRENCH.getLanguage(), null, "Fran\347ais");
        supportedLocales[2] = new UserLocale("es", null, "Espa\361ol");
        supportedLocales[3] = new UserLocale("pt", null, "Portugu\352s");
        supportedLocales[4] = new UserLocale(Locale.UK.getLanguage(), Locale.UK.getCountry(), "English-GB");
        supportedLocales[5] = new UserLocale("sv", null, "Svenskt");
        supportedLocales[6] = new UserLocale("nb", null, "Norske");
        supportedLocales[7] = new UserLocale("da", null, "Dansk");
        supportedLocales[8] = new UserLocale("fi", null, "Suomi");
        supportedLocales[9] = new UserLocale("nl", null, "Nederlands");
        supportedLocales[10] = new UserLocale(Locale.FRENCH.getLanguage(), Locale.CANADA.getCountry(), "Fran\347ais-CA");
        supportedLocales[11] = new UserLocale(Locale.GERMAN.getLanguage(), null, "Deutsch");
        UserLocale auserlocale[] = supportedLocales;
        int j = auserlocale.length;
        for (int i = 0; i < j; i++)
        {
            UserLocale userlocale = auserlocale[i];
            Log.d("nf_loc", (new StringBuilder()).append("").append(userlocale).toString());
        }

    }
Beispiel #2
0
 static {
   GOOGLE_COUNTRY_TLD = new HashMap<String, String>();
   GOOGLE_COUNTRY_TLD.put("AR", "com.ar"); // ARGENTINA
   GOOGLE_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA
   GOOGLE_COUNTRY_TLD.put("BR", "com.br"); // BRAZIL
   GOOGLE_COUNTRY_TLD.put("BG", "bg"); // BULGARIA
   GOOGLE_COUNTRY_TLD.put(Locale.CANADA.getCountry(), "ca");
   GOOGLE_COUNTRY_TLD.put(Locale.CHINA.getCountry(), "cn");
   GOOGLE_COUNTRY_TLD.put("CZ", "cz"); // CZECH REPUBLIC
   GOOGLE_COUNTRY_TLD.put("DK", "dk"); // DENMARK
   GOOGLE_COUNTRY_TLD.put("FI", "fi"); // FINLAND
   GOOGLE_COUNTRY_TLD.put(Locale.FRANCE.getCountry(), "fr");
   GOOGLE_COUNTRY_TLD.put(Locale.GERMANY.getCountry(), "de");
   GOOGLE_COUNTRY_TLD.put("GR", "gr"); // GREECE
   GOOGLE_COUNTRY_TLD.put("HU", "hu"); // HUNGARY
   GOOGLE_COUNTRY_TLD.put("ID", "co.id"); // INDONESIA
   GOOGLE_COUNTRY_TLD.put("IL", "co.il"); // ISRAEL
   GOOGLE_COUNTRY_TLD.put(Locale.ITALY.getCountry(), "it");
   GOOGLE_COUNTRY_TLD.put(Locale.JAPAN.getCountry(), "co.jp");
   GOOGLE_COUNTRY_TLD.put(Locale.KOREA.getCountry(), "co.kr");
   GOOGLE_COUNTRY_TLD.put("NL", "nl"); // NETHERLANDS
   GOOGLE_COUNTRY_TLD.put("PL", "pl"); // POLAND
   GOOGLE_COUNTRY_TLD.put("PT", "pt"); // PORTUGAL
   GOOGLE_COUNTRY_TLD.put("RU", "ru"); // RUSSIA
   GOOGLE_COUNTRY_TLD.put("SK", "sk"); // SLOVAK REPUBLIC
   GOOGLE_COUNTRY_TLD.put("SI", "si"); // SLOVENIA
   GOOGLE_COUNTRY_TLD.put("ES", "es"); // SPAIN
   GOOGLE_COUNTRY_TLD.put("SE", "se"); // SWEDEN
   GOOGLE_COUNTRY_TLD.put(Locale.TAIWAN.getCountry(), "tw");
   GOOGLE_COUNTRY_TLD.put("TR", "com.tr"); // TURKEY
   GOOGLE_COUNTRY_TLD.put(Locale.UK.getCountry(), "co.uk");
   GOOGLE_COUNTRY_TLD.put(Locale.US.getCountry(), "com");
 }
Beispiel #3
0
 static {
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD = new HashMap<String, String>();
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.CHINA.getCountry(), "cn");
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.FRANCE.getCountry(), "fr");
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.GERMANY.getCountry(), "de");
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.ITALY.getCountry(), "it");
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.JAPAN.getCountry(), "co.jp");
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("NL", "nl"); // NETHERLANDS
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("ES", "es"); // SPAIN
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.UK.getCountry(), "co.uk");
   GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.US.getCountry(), "com");
 }
  public void testGetFormatDate() {
    Locale locale = new Locale(Locale.ENGLISH.getLanguage(), Locale.UK.getCountry());
    Calendar calendar = Calendar.getInstance();
    // set date time: 28/08/2011 at 15h 30m
    calendar.set(2011, 07, 28, 15, 30);
    assertEquals("", TimeConvertUtils.getFormatDate(null, "M-d-yyyy", locale));
    assertEquals("", TimeConvertUtils.getFormatDate(calendar.getTime(), "", locale));

    assertEquals(
        "8-28-2011", TimeConvertUtils.getFormatDate(calendar.getTime(), "M-d-yyyy", locale));
    assertEquals("8-28-11", TimeConvertUtils.getFormatDate(calendar.getTime(), "M-d-yy", locale));
    assertEquals(
        "08-28-11", TimeConvertUtils.getFormatDate(calendar.getTime(), "MM-dd-yy", locale));
    assertEquals(
        "08-28-2011", TimeConvertUtils.getFormatDate(calendar.getTime(), "MM-dd-yyyy", locale));
    assertEquals(
        "2011-08-28", TimeConvertUtils.getFormatDate(calendar.getTime(), "yyyy-MM-dd", locale));
    assertEquals(
        "11-08-28", TimeConvertUtils.getFormatDate(calendar.getTime(), "yy-MM-dd", locale));
    assertEquals(
        "28-08-2011", TimeConvertUtils.getFormatDate(calendar.getTime(), "dd-MM-yyyy", locale));
    assertEquals(
        "28-08-11", TimeConvertUtils.getFormatDate(calendar.getTime(), "dd-MM-yy", locale));
    assertEquals(
        "8/28/2011", TimeConvertUtils.getFormatDate(calendar.getTime(), "M/d/yyyy", locale));
    assertEquals("8/28/11", TimeConvertUtils.getFormatDate(calendar.getTime(), "M/d/yy", locale));
    assertEquals(
        "08/28/11", TimeConvertUtils.getFormatDate(calendar.getTime(), "MM/dd/yy", locale));
    assertEquals(
        "08/28/2011", TimeConvertUtils.getFormatDate(calendar.getTime(), "MM/dd/yyyy", locale));
    assertEquals(
        "2011/08/28", TimeConvertUtils.getFormatDate(calendar.getTime(), "yyyy/MM/dd", locale));
    assertEquals(
        "11/08/28", TimeConvertUtils.getFormatDate(calendar.getTime(), "yy/MM/dd", locale));
    assertEquals(
        "28/08/2011", TimeConvertUtils.getFormatDate(calendar.getTime(), "dd/MM/yyyy", locale));
    assertEquals(
        "28/08/11", TimeConvertUtils.getFormatDate(calendar.getTime(), "dd/MM/yy", locale));

    assertEquals(
        "Sun, August 28, 2011",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "EEE, MMMM dd, yyyy", locale));
    assertEquals(
        "Sunday, August 28, 2011",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "EEEE, MMMM dd, yyyy", locale));
    assertEquals(
        "Sunday, 28 August, 2011",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "EEEE, dd MMMM, yyyy", locale));
    assertEquals(
        "Sun, Aug 28, 2011",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "EEE, MMM dd, yyyy", locale));
    assertEquals(
        "Sunday, Aug 28, 2011",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "EEEE, MMM dd, yyyy", locale));
    assertEquals(
        "Sunday, 28 Aug, 2011",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "EEEE, dd MMM, yyyy", locale));
    assertEquals(
        "August 28, 2011",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "MMMM dd, yyyy", locale));
    assertEquals(
        "28 August, 2011",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "dd MMMM, yyyy", locale));
    assertEquals(
        "Aug 28, 2011", TimeConvertUtils.getFormatDate(calendar.getTime(), "MMM dd, yyyy", locale));
    assertEquals(
        "28 Aug, 2011", TimeConvertUtils.getFormatDate(calendar.getTime(), "dd MMM, yyyy", locale));

    assertEquals(
        "28 Aug, 2011, 03:30 PM",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "dd MMM, yyyy, hh:mm a", locale));
    assertEquals(
        "28 Aug, 2011, 15:30",
        TimeConvertUtils.getFormatDate(calendar.getTime(), "dd MMM, yyyy, HH:mm", locale));
  }