Article View: borland.public.jbuilder.java.language
Article #7161Re: Java International
From: Rich Wilkman
Date: Fri, 06 Jul 2001 16:59
Date: Fri, 06 Jul 2001 16:59
113 lines
4689 bytes
4689 bytes
Russell:
Hand code in unicode escape sequences or use some different file format
that supports raw Chinese characters and write a stream reader off of
that.
That's why you usually pay a translation house to do the conversion for
you, though.
-Rich
Russell wrote:
>
> 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:
<3B45EE6F.5C29DD3D@formlessvoid.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!grolier!skynet.be!news.algonet.se!algonet!newsfeed1.uni2.dk!newssuck.uni2.dk!dnewsReferences:
<3B441B3B.B329E9A6@cesmainternational.com> <3B449277.CA4525E6@formlessvoid.com> <3B451236.99E0E7B3@cesmainternational.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-06 10:04:06 PST Message-ID: <3B45EE6F.5C29DD3D@formlessvoid.com> Date: Fri, 06 Jul 2001 09:59:27 -0700 From: Rich Wilkman <richw@formlessvoid.com> X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) 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> <3B451236.99E0E7B3@cesmainternational.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 208.236.69.60 X-Trace: dnews 994438767 208.236.69.60 (6 Jul 2001 09:59:27 -0700) Lines: 113 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!grolier!skynet.be!news.algonet.se!algonet!newsfeed1.uni2.dk!newssuck.uni2.dk!dnews