Article View: borland.public.jbuilder.java.language
Article #7159Re: Java International
From: Russell
Date: Fri, 06 Jul 2001 01:19
Date: Fri, 06 Jul 2001 01:19
100 lines
4246 bytes
4246 bytes
Thanks.Found the problem.
I have an question , for example . if i want to display application in
chinese however there are 1000++ character in chinese.
So my question is how i am going to store chinese character in my
properties files ?? Hand coded it :)?
Thanks.
Rich Wilkman wrote:
>
> Russell:
>
> First, add a package statement to your code. This is good practice and
> makes it much easier for things to be found properly on the classpath.
>
> Once you have done that, your .properties file goes in the same
> directory on the classpath as the copiled version of your class that
> needs it. Right now it's just probably choking on the "default package"
> concept of Java which is the fake one that gets used when you don't
> specify a package statement in your code.
>
> -Rich
>
> Russell wrote:
> >
> >
> > Hi all , I am using Jbuilder3.5 , RedHat6.1 and jdk1.2.2
> >
> > Below is the code Java Internationalization.
> > It always give me the error message :
> >
> > Exception in thread "main" java.util.MissingResourceException: Can't
> > find resource for base name Messages, locale en_US
> > at java.util.ResourceBundle.getBundle(ResourceBundle.java:423)
> > at java.util.ResourceBundle.getBundle(ResourceBundle.java:353)
> > at inter.InterNational.<init>(InterNational.java:56)
> > at inter.InterNational.main(InterNational.java:41)
> >
> > I have create a Messages.properties and Messages_fr_FR.properties . They
> > are added on my classpath.
> > Anybody have any ideas how to do it ? Thanks
> >
> > import java.util.*;
> > import javax.swing.*;
> > import java.awt.*;
> > import java.awt.event.*;
> >
> > public class InterNational extends JFrame{
> >
> > String yesCaption;
> > String noCaption;
> >
> > static String language;
> > static String country;
> >
> > JButton yesButton,noButton;
> >
> > static public void main(String[] args) {
> >
> > if (args.length != 2) {//Use I18N fr FR (French)
> > //or
> > //I18N en US (US English)
> >
> > System.out.println("Use :java I18N Language country");
> > System.exit(1);
> > }
> >
> > language = new String(args[0]);
> > country = new String(args[1]);
> >
> > InterNational frame=new InterNational();
> >
> > frame.addWindowListener(new WindowAdapter() {
> > public void windowClosing(WindowEvent e) {
> > System.exit(0);
> > }
> > });
> >
> > frame.setBounds(0,0,200,100);
> > frame.setVisible(true);
> > }//main
> >
> > public InterNational(){
> >
> > Locale locale = new Locale(language, country);
> > ResourceBundle captions= ResourceBundle.getBundle("Messages",locale);
> >
> > yesCaption =captions.getString("yesMessage");
> > noCaption = captions.getString("noMessage");
> >
> > yesButton = new JButton(yesCaption);
> > noButton = new JButton(noCaption);
> >
> > getContentPane().add(yesButton,BorderLayout.WEST);
> > getContentPane().add(noButton,BorderLayout.EAST);
> >
> > }//I18N construct
> >
> > }//I18N
Technical Details
Message-ID:
<3B451236.99E0E7B3@cesmainternational.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-xit-04!supernews.com!feed.textport.net!out.nntp.be!propagator-dallas!news-in-dallas.newsfeeds.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3B441B3B.B329E9A6@cesmainternational.com> <3B449277.CA4525E6@formlessvoid.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,77456493706f8736 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-07-05 18:30:50 PST Message-ID: <3B451236.99E0E7B3@cesmainternational.com> Date: Fri, 06 Jul 2001 09:19:50 +0800 From: Russell <weetat@cesmainternational.com> X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.13-0.13 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Java International References: <3B441B3B.B329E9A6@cesmainternational.com> <3B449277.CA4525E6@formlessvoid.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 203.126.155.39 X-Trace: dnews 994382414 203.126.155.39 (5 Jul 2001 18:20:14 -0700) Lines: 100 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!sn-xit-04!supernews.com!feed.textport.net!out.nntp.be!propagator-dallas!news-in-dallas.newsfeeds.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews