不好意思!
 低级错误:
  
  property 改为properties

解决方案 »

  1.   


     YuLimin(阿敏当兵) 兄台: java.util.ResourceBundle
      
     在我不知道有多少时,如何获取所有的国际化信息呀?
      

  2.   

    看文档不就行了!SimpleI18NTest.html<title>Test</title>
    <applet code="SimpleI18NTest.class" width=200 height=100>
    </applet>
    SimpleI18NTest.javaimport java.applet.Applet;
    import java.util.Locale;
    import java.util.MissingResourceException;
    import java.util.ResourceBundle;import java.awt.Choice;
    import java.awt.Label;
    import java.awt.event.ItemEvent;
    import java.awt.event.ItemListener;public class SimpleI18NTest extends Applet implements ItemListener
    {
        private Label guiLabel = new Label();
        private Choice choice = new Choice();
        private Object[] localeCountry =
            {
            Locale.ENGLISH,
            Locale.FRENCH,
            Locale.CANADA,
            Locale.CHINA,
            Locale.CHINESE,
            Locale.TAIWAN//在JDK1.2.2的AppletViewer打开,当中:中国台湾为...!!!愤怒!!!
        };    public void init()
        {
            for(int i = 0;i < localeCountry.length;i++)
            {
                choice.add(((Locale)localeCountry[i]).getDisplayName());
            }        choice.addItemListener(this);        add(choice);
            add(guiLabel);        guiLabel.setLocale(Locale.ENGLISH);
            internationalize();
        }    public void itemStateChanged(ItemEvent event)
        {
            int index = choice.getSelectedIndex();
            guiLabel.setLocale((Locale)localeCountry[index]);        /*        if(index == 0)
                    {
                        guiLabel.setLocale(Locale.ENGLISH);
                    }
                    else
                    {
                        guiLabel.setLocale(Locale.FRENCH);
                    }
             */        internationalize();
            validate();
        }    private void internationalize()
        {
            String s = getIdentifierString(guiLabel.getLocale());        if(s != null)
            {
                guiLabel.setText(s);
                guiLabel.invalidate();
            }
        }    private String getIdentifierString(Locale l)
        {
            ResourceBundle bundle = null;        try
            {
                bundle = ResourceBundle.getBundle("LabelsBundle",l);
            }
            catch(MissingResourceException e)
            {
                e.printStackTrace();
            }
            if(bundle == null)
            {
                return null;
            }
            else
            {
                return(String)bundle.getObject("Identifier");
            }
        }
    }建立文件
    LabelsBundle_en.properties
    LabelsBundle_fr.properties
    LabelsBundle_zh.properties
    LabelsBundle_zh_CN.properties
    LabelsBundle_zh_TW.properties内容
    # SimpleI8N zh_CN Property BundleIdentifier=GUI zh_CN 中华人民共和国