2 Replies Latest reply on Jul 16, 2009 4:44 PM by 843810

    Is Locale required for multi language?

      Hi Folks,
      I used Locale to represent multi language or directly using unicode characters, these 2 scenarios as follows:

      Using Locale:
      <%@ page import="java.util.*" %>
      <%@page contentType="text/html;charset=UTF-8"%>
              String language;
              String country;
              Locale locale;
              ResourceBundle rb;
                  language = new String("hi");
                  country = new String("IN");
               locale = new Locale(language, country);
               rb = ResourceBundle.getBundle("MessagesBundle", locale);
               System.out.println(rb.getString("localeInfo") + " ( " + 
      locale.getDisplayLanguage() + "," + locale.getDisplayCountry() + ").\n");
      And the property file is with name "MessagesBundle_hi_IN.properties":

      localeInfo = \u0917\u0941\u0930\u0941\u0020\u0915\u0949\u092a\u0964
      welcome = *\u0917\u0941\u0930\u0941\u0020\u0915\u0949\u092a\u0964*
      sayThanks = \u0917\u0941

      i got the required output.
      Now with out using Locale i directly pass the unicode value directly and got the same output.

      String text="*\u0917\u0941\u0930\u0941\u0020\u0915\u0949\u092a\u0964*";
      //Character.subset block2=Character.subset(text);

      As we can do the same thing directly passing unicode with out using Locale then what is the use of it?


      Edited by: RajeshwarReddyT on Jul 16, 2009 10:05 AM