FileDocCategorySizeDatePackage
PI18n.javaAPI DocJ2ME CLDC 1.11560Wed Feb 05 15:56:04 GMT 2003text

PI18n

public class PI18n extends Object
This class is to get the resource file with the current locale set by JDK. Use ResourceBundle objects to isolate locale-sensitive date, such as translatable text. The second argument passed to getBundle method identify which properties file we want to access. The first argument refers to the actual properties files. When the locale was created, the language code and country code were passed to its constructor. The property files are named followed by the language and country code.

Fields Summary
public ResourceBundle
bundle
public String
propertyName
Constructors Summary
public PI18n(String str)

    
       
    propertyName = new String(str);
    
Methods Summary
public java.lang.StringgetString(java.lang.String key)

       Locale currentLocale = java.util.Locale.getDefault();

       if (bundle == null) {
           try{
               bundle = ResourceBundle.getBundle(propertyName, currentLocale);
           } catch(java.util.MissingResourceException e){
               System.out.println("Could not load Resources");
               System.exit(0);
           }
        }
        String value = new String("");
        try{
            value = bundle.getString(key);
        } catch (java.util.MissingResourceException e){
            System.out.println("Could not find " + key);}
        return value;