Write an Remote Method Invocaion Program for object internationalization

Aim: - Write an RMI Program for internationalization
Tools: - NetBeans IDE, jdk

Theory:-

Ø  Internationalization is the process of designing an application so that it can be adapted to various languages and regions without engineering changes.
Ø  Sometimes the term internationalization is abbreviated as i18n, because there are 18 letters between the first "i" and the last "n."

An internationalized program has the following characteristics:

Ø  With the addition of localization data, the same executable can run worldwide.
Ø  Textual elements, such as status messages and the GUI component labels, are not hardcoded in the program. Instead they are stored outside the source code and retrieved dynamically.
Ø  Support for new languages does not require recompilation.
Ø  Culturally-dependent data, such as dates and currencies, appear in formats that conform to the end user's region and language.
Ø  It can be localized quickly.

 

Program:-

 

import java.util.Locale;
import java.util.ResourceBundle;
public class Demointr {
    public static void main(String[] args) {
        String language;
        String country;
        if (args.length != 2) {
            language = new String("fr");
            country = new String("FR");
        } else {
            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"));    }
}

MessagesBundle.properties

greetings = Hello.
farewell = Goodbye.
inquiry = How are you?

MessagesBundle_de_DE.properties

greetings = Hallo.
farewell = Tschüß.
inquiry = Wie geht's?

MessagesBundle_en_US.properties

greetings = Hello.
farewell = Goodbye.
inquiry = How are you?

MessagesBundle_fr_FR.properties

greetings = Bonjour.
farewell = Au revoir.

inquiry = Comment allez-vous?

Output:-



Post a Comment

0 Comments