[kaffe] ".properties" files with Kaffe

Warwick Hunter whunter at agile.tv
Mon Mar 10 22:56:02 PST 2003


Tanguy

 > Does anybody know how I can use ".properties" files like
 > "javax.comm.properties" with Kaffe ?

It should work the same under Kaffe as under any other JVM.
If not then please send a bug report through to this list.

Warwick

import java.util.ResourceBundle;
import java.util.MissingResourceException;

/**
  * This is a helper class for internationalisation
  *
  * @author Warwick Hunter
  * @since  2002-03-17
  */
public class I18N
{
     private ResourceBundle m_bundle     = null;
     private String         m_bundleName = null;

     public I18N(String bundle)
     {
         m_bundleName = bundle;
     }

     /**
      * This method returns a string from the resource bundle.
      */
     public String getString(String key)
     {
         String value = null;
         try
         {
             value = getResourceBundle().getString(key);
         }
         catch (MissingResourceException e)
         {
             value = null;
     	}
         return value;
     }

     /**
      * Returns the resource bundle. Used
      * to get accessable and internationalized strings.
      */
     private ResourceBundle getResourceBundle()
     {
         if (m_bundle == null)
         {
             m_bundle = ResourceBundle.getBundle(m_bundleName);
         }
         return m_bundle;
     }

} // I18N





-- 
Warwick Hunter                    Agile TV Corporation
Voice: +61 7 5584 5912            Fax: +61 7 5575 9550
mailto:whunter at agile.tv           http://www.agile.tv





More information about the kaffe mailing list