package com.mindprod.whaz;

import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.JButton;
import javax.swing.JLabel;

public class Bundle
   {

   /**
    * test harness
    *
    * @param args not used
    */
   public static void main ( String[] args )
      {
      Locale currentLocale = Locale.getDefault();
      out.println( currentLocale ); // e.g. en_CA

      // select the ResourceBundle closest fit to this locale
      // note, you don't specifiy the .properties or _en_CA
      // A corresponding resource might be called MyResources_en_CA.properties
      // Unlike ordinary resources handling, getBundle will
      // not prepend the package name on the resource automatically.

      ResourceBundle myResources =
      ResourceBundle.getBundle( "MyResources", currentLocale );

      // you retrieve the localised string with a unique key string.
      JButton okButton = new JButton( myResources.getString( "OkButtonLabel" ));
      JLabel hoursLabel = new JLabel( myResources.getString( "hours" ));
      out.println( okButton.getText() ); // e.g. Eh?
      out.println( hoursLabel.getText() ); // e.g. HH
      }
   }