Skip to Content

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://weblogs.sdn.sap.com/weblogs/images/35818/I18N1.jpg|border=0!

Step 2:

Create one Java class

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

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”));

     }

}

image

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply