Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Introduction:


In my last weblog I have discussed about different techniques used in Java for Internationalization. Here I am going to give step by step procedure of internationalized application development in Web Application server both in Java Perspective and WebDynpro Perspective using Java Resource Bundle Technique.



I. Java Perspective:


Step 1:




Create one Java application



!https://weblogs.sdn.sap.com/weblogs/images/35818/I18N1.jpg|height=400|alt=image|width=500|src=https:...!




Step 2:




Create one Java class


!https://weblogs.sdn.sap.com/weblogs/images/35818/I18N2.jpg|height=400|alt=image|width=493|src=https:...!



Step 3:





Add the Following source code

Notice that the text of the messages is not hard coded.



     package com.wipro;

     import java.util.*;

     /**

     

  • @author kanthan

     

  • To change the template for this generated type

        comment go to

     

  • Window>Preferences>Java>Code

        Generation>Code and Comments

     */

     public class I18N {

     public static void main(String[] args) {

       String language;

          String country;

          language = new String(args[0]);

          country = new String(args[1]);

          Locale currentLocale;

          ResourceBundle messages;

          currentLocale = new Locale(language, country);

          messages = ResourceBundle.getBundle

               ("MessagesBundle",currentLocale);

            System.out.println(messages.getString("greetings"));

     System.out.println(messages.getString("inquiry"));

     System.out.println(messages.getString("farewell"));

     }

}

2 Comments