import java.applet.*; import java.awt.*; import java.util.*; public class Intl extends Applet { Label theLbl = new Label(); Font font = new Font("Serif",Font.BOLD,24); // test function private static void dbg(Locale l) { Locale.setDefault(l); System.out.println(Locale.getDefault().toString() + "=" + l.getDisplayLanguage() + "/" + l.getDisplayCountry()); ResourceBundle rez = ResourceBundle.getBundle("IntlRes"); System.out.println(rez.getString("msg1")); System.out.println(rez.getString("msg2")); } // test main -- calls test function for a few countries public static void main(String[] args) { dbg(Locale.FRANCE); dbg(Locale.US); dbg(Locale.UK); dbg(Locale.CANADA); // nothing specific -- gets default } public void init() { ResourceBundle rez = ResourceBundle.getBundle("IntlRes"); theLbl.setFont(font); theLbl.setText(rez.getString("msg1")); add(theLbl); } }
Java@Work | Parlez-Vous Java? (Web Techniques, Sep 2000)
Nothing has made the world smaller than the Web. Today more than ever, you're likely to develop programs that will serve people in countries around the world. However, Esperanto notwithstanding, there's no international language, and some percentage of your users won't be native English speakers. In fact, many may not speak or read English at all. To make sure these visitors can use your programs with ease, you need to take internationalization issues into account.Related Reading
More Insights
INFO-LINK
To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy. | |