advertisement

Search Tips
Articles  |   Tutorials  |   Reviews  |   Dev Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source Code  |  

Browse DevX
DevX Updates - Sign Up Here


Partners & Affiliates



advertisement

Articles : Advanced Topics in Java :
Internationalization :

Contents
Introduction
Naming Resource Bundles
Creating Resource Bundles by Direct Subclassing
Using ListResourceBundle
Using PropertyResourceBundle
Compiling Resource Bundles

Compiling Resource Bundles

While Java uses Unicode as its internal character set most operating systems, editors, and other tools still use regional code pages to represent text. The Java compiler automatically assumes that your resource files are written in the default code page of your operating system as defined in the system property "file.encoding".

So, if you're using the U.S. English version of Windows NT, the compiler will probably assume your character set is ISO 8859-1. If you need to compile a Cyrillic or Greek language bundle, you would get misleading results.

Use the -encoding option at compile time to specify the character set of the source file and use the appropriate converter to direct the compiler to accurately convert the source into Unicode.

Which bundle to use?

There are plenty of reasons why you might want to subclass the java.util.ResourceBundle rather than use the ListResourceBundle, PropertyResourceBundle. Maybe you'd like to read all text from a database or want to create bundle classes that specialize in types of data access for performance reasons. It's up to you, and if you find a reason why the available bundles don't work for you, you can modify and extend their behavior and performance.

Conclusion

Resource bundles are a quick and simple way to isolate translatable text or localizable objects from the core source code especially with many of the new IDEs including resource-bundle creation and management tools.

References

  1. The internationalization specification
  2. Unicode and Unicode specifications
  3. ISO-3166
  4. The java.util API documentation

Sameer Tyagi is a Software Engineer with several years of programming experience in iNet application development and has conducted multiple training workshops in Java. Besides holding an Engineering degree in Electronics he is a Sun Certified Java 1.1 Programmer.
Email: sameertyagi@usa.net

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

internet.com logo


JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.
Blackmail Applet
This applet prints out text that looks like letters cut out of a newspaper. You can specify the text, the width and height of the applet and the delay after each letter. Future versions will have more parameters.
JB User Poll
What is your primary tool for learning Java?
The JavaBoutique Top 15:
1. articles.rdf
2. welcomead
3. applets.rdf
4. quickserv
5. 3DMaze
6. dotz
7. Froz_Bubb
8.
9. KaaBlitz
10. anglefinder
11. ChompText
12. DS_ClockWipe
13. Pool
14. Search2
15. PacMan
Want more? Check out our Top 100!

Refer-It
Affiliate Program and Referral Directory.
New on internet.com
Google IM Not Talking to Other Jabbers
Newly-launched Google Talk IM service doesn't connect to other open source Jabber servers and users -- at least not yet.

Printer Sets Good Example for Small Business Security
While surveys suggest that small businesses aren't prepared for ever-present security dangers, this Boston-area printer has maintained a pristine operation since a scare six years ago.

VoIP Gizmo Comes to Universities
As student gear up for back to school, a SIP-based initiative aims to VoIP-enable universities around the world for free calling.



Copyright 2002 INT Media Group, Incorporated. All Rights Reserved.
Legal Notices,  Licensing, Reprints, & Permissions,  Privacy Policy.
http://www.internet.com/