Package java.util

Examples of java.util.Locale


        if(pos > 0) {
            String getsArg = uri.substring(SYSTEM_COLLATION.length());
            final int sharppos = getsArg.indexOf('#');
            String qloc = (sharppos > 0) ? getsArg.substring(0, sharppos - 1) : getsArg;
            String args[] = qloc.split("-");
            final Locale loc;
            final int loclen = args.length;
            switch(loclen) {
                case 1:
                    loc = new Locale(args[0]);
                    break;
                case 2:
                    loc = new Locale(args[0], args[1]);
                    break;
                case 3:
                    loc = new Locale(args[0], args[1], args[2]);
                    break;
                default:
                    throw new IllegalArgumentException("invalid collation uri: " + uri);
            }
            final Collator col = Collator.getInstance(loc);
View Full Code Here


   
    String[] drop_labels = new String[ locales.length ];
    String[] drop_values = new String[ locales.length ];
    int iUsingLocale = -1;
    for( int i=0; i < locales.length; i++ ) {
      Locale locale = locales[ i ];
      String sName = locale.getDisplayName(locale);
      String sName2 = locale.getDisplayName();
      if (!sName.equals(sName2)) {
        sName += " - " + sName2;
      }
      drop_labels[ i ] = sName + " - " + locale;
      drop_values[ i ] = locale.toString();
      if (MessageText.isCurrentLocale(locale))
        iUsingLocale = i;
    }
   
    StringListParameter locale_param = new StringListParameter(cMain, "locale",
View Full Code Here

    String sessionID = requestForm.getSessionID();
    HttpSession session = request.getSession();
    UserObject userobjectd = (UserObject)session.getAttribute("userobject");
    UserPrefererences userPrefs = userobjectd.getUserPref();
    TimeZone tz = TimeZone.getTimeZone(userPrefs.getTimeZone());
    Locale locale = request.getLocale();
    int individualID = userobjectd.getIndividualID();
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    // date format for writing to the form should be in the format based on
    // locale
    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
View Full Code Here

    request.setAttribute("showCustomViews", new Boolean(false));
    request.setAttribute("showComposeButton", new Boolean(false));
    request.setAttribute("showNewButton", new Boolean(false));
    request.setAttribute("showPrintButton", new Boolean(false));
    // Description must allow i18n
    Locale locale = request.getLocale();
    MessageResources messages = MessageResources.getMessageResources("ApplicationResources");
    String searchButtonDescription = messages.getMessage(locale,
        "label.home.searchbutton.description");
    request.setAttribute("searchButtonDescription", searchButtonDescription);
    request.setAttribute("hideListDropdown", new Boolean(true));
View Full Code Here

    UserObject userobjectd = (UserObject)session.getAttribute("userobject");

    // get the user's preference for sync'ing as private or default privileges
    UserPrefererences userPrefs = userobjectd.getUserPref();
    TimeZone tz = TimeZone.getTimeZone(userPrefs.getTimeZone());
    Locale locale = request.getLocale();
    String prefValue = userPrefs.getSyncAsPrivate();
    boolean syncAsPrivate = (prefValue != null && prefValue.equals("YES")) ? true : false;

    // date format for incoming dates: 2004-01-13 15:00:00
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
View Full Code Here

  public void readFurnitureLibrary(final FurnitureLibrary furnitureLibrary,
                                   String furnitureLibraryName,
                                   FurnitureLibraryUserPreferences preferences) throws RecorderException {
    try {
      // Retrieve furniture library with default reader and locale
      Locale defaultLocale = Locale.getDefault();
      Locale.setDefault(DEFAULT_LOCALE);
      File furnitureLibraryFile = File.createTempFile("furniture", ".sh3f");
      furnitureLibraryFile.deleteOnExit();
      copyFile(new File(furnitureLibraryName), furnitureLibraryFile);     
      URL furnitureLibraryUrl = furnitureLibraryFile.toURI().toURL();
View Full Code Here

   */
  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

                  ", ", 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

        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

                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

TOP

Related Classes of java.util.Locale

Copyright © 2018 www.massapicom. 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.