Examples of Locale


Examples of java.util.Locale

   */
  private Locale getLocale(String fileName) {
    String localeString = fileName.substring(DefaultFurnitureCatalog.PLUGIN_FURNITURE_CATALOG_FAMILY.length(),
        fileName.lastIndexOf(".properties"));
    if (localeString.matches("_\\w{2}")) {
      return new Locale(localeString.substring(1));
    } else if (localeString.matches("_\\w{2}_\\w{2}")) {
      return new Locale(localeString.substring(1, 3), localeString.substring(4));
    } else {
      return DEFAULT_LOCALE;
   
  }
View Full Code Here

Examples of java.util.Locale

                  ", ", false);
              while (lst.hasMoreTokens()) {
                String lan = lst.nextToken();
                int di = lan.indexOf('-');
                if (di < 0)
                  ts.add(new LocaleWithWeight(new Locale(lan
                      .trim()) /* 1.4 */, w));
                else
                  ts.add(new LocaleWithWeight(new Locale(lan
                      .substring(0, di), lan
                      .substring(di + 1).trim()
                      .toUpperCase()), w));
              }
            }
View Full Code Here

Examples of java.util.Locale

        assertEquals(expected.getClass().getName(), o.getClass().getName());
        assertTrue(expected.equals(o));
    }

    private void testSpecialLocale() throws SQLException {
        Locale old = Locale.getDefault();
        try {
            // when using Turkish as the default locale, "i".toUpperCase() is not "I"
            Locale.setDefault(new Locale("tr"));
            stat.execute("create table test(I1 int, i2 int, b int, c int, d int) as select 1, 1, 1, 1, 1");
            ResultSet rs = stat.executeQuery("select * from test");
            rs.next();
            rs.getString("I1");
            rs.getString("i1");
View Full Code Here

Examples of java.util.Locale

                else
                    return new Character(charValue);
            } else if (clazz.equals(Locale.class)) {
                String[] components = sValue.split("_", 2);
                if (components.length == 2) {
                    return new Locale(components[0], components[1]);
                } else {
                    return new Locale(sValue);
                }
            } else if (Enum.class.isAssignableFrom(clazz)) {
                return Enum.valueOf(clazz, sValue);
            }
        } else if(clazz != null && !clazz.isPrimitive() /*Boolean reaches here*/ && !clazz.isAssignableFrom(value.getClass())){
View Full Code Here

Examples of java.util.Locale

       * 4 preconfig locales: English, France, Arabic, Vietnamese
      **/
      Collection<LocaleConfig> locales = service_.getLocalConfigs();
      assertTrue(locales.size() == 4);

      Locale vnlocale = service_.getLocaleConfig("vi").getLocale();
      assertContains(locales, vnlocale);
      assertContains(locales, Locale.ENGLISH);
      assertContains(locales, Locale.FRENCH);
   }
View Full Code Here

Examples of java.util.Locale

    // by default, set isSelected equal to false.
    // This ensures no null pointer if something
    // goes wrong or isSelected is not set explicitly.
    this.isSelected = false;
    this.resourceKey = "";
    locale = new Locale("en");
  }
View Full Code Here

Examples of java.util.Locale

      try
      {
         Collection<LocaleConfig> localeConfigs = localeService_.getLocalConfigs();
         // String defaultLang =
         // localeService_.getDefaultLocaleConfig().getLanguage();
         Locale defaultLocale = localeService_.getDefaultLocaleConfig().getLocale();

         for (Iterator<LocaleConfig> iter = localeConfigs.iterator(); iter.hasNext();)
         {
            LocaleConfig localeConfig = iter.next();
            // String language = localeConfig.getLanguage();
            // String content = getResourceBundleContent(name, language,
            // defaultLang, cl);
            Locale locale = localeConfig.getLocale();
            String language = locale.getLanguage();
            String country = locale.getCountry();

            String content = getResourceBundleContent(name, locale, defaultLocale, cl);
            if (content != null)
            {
               // save the content
View Full Code Here

Examples of java.util.Locale

      if (locale_ == null)
      {
         String[] localeParams = localeName.split("_");
         if (localeParams.length > 1)
         {
            locale_ = new Locale(localeParams[0], localeParams[1]);
         }else{
            locale_ = new Locale(localeName);
         }
      }
   }
View Full Code Here

Examples of java.util.Locale

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws RuntimeException, Exception {
    HttpSession session = request.getSession(true);
    UserObject user = (UserObject)session.getAttribute("userobject");
    UserPrefererences prefs = user.getUserPref();
    TimeZone tz = TimeZone.getTimeZone(prefs.getTimeZone());
    Locale locale = request.getLocale();
   
    String forward = ".view.calendar.datetime";
    // "dateTimeSelectForm" in mappings/calendar.xml
    DynaActionForm dateForm = (DynaActionForm) form;
    try {
View Full Code Here

Examples of java.util.Locale

            // however, could cache the last few instances
            SimpleDateFormat df;
            if (locale == null) {
                df = new SimpleDateFormat(format);
            } else {
                Locale l = new Locale(locale);
                df = new SimpleDateFormat(format, l);
            }
            if (timeZone != null) {
                df.setTimeZone(TimeZone.getTimeZone(timeZone));
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.