Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2006

Tip: Looking for answers? Try searching our database.

Question about i18n performance and comfort

Thread view: 
Wojciech Halicki-Piszko - 03 Mar 2006 09:50 GMT
I want i18n application. It has lots of (for me) panels and I'd like to
ease my translation work. What is the better way: point all classes to one
big file with translations (now I made it through static method in main
class of an application) or point every class to its own translation
within its own package? And this is the other thing that makes me do it
one-big-file way - there are many packages and I think it would be easier
to maintain one file then walk through lots of directories

Thanks for any response
Rhino - 03 Mar 2006 18:52 GMT
>I want i18n application. It has lots of (for me) panels and I'd like to
> ease my translation work. What is the better way: point all classes to one
[quoted text clipped - 5 lines]
>
> Thanks for any response

Have you read the chapter on i18n in the Java Tutorial? This is the link in
case you haven't: http://java.sun.com/docs/books/tutorial/i18n/index.html.

I've used the approach they suggest and found it quite satisfactory. They
certainly don't recommend putting everything in one big file!

I think most Java programs will consist of many different classes in several
different packages; this is almost inevitable if you design Java correctly,
according to the OO paradigm.

In my case, my projects tend to have one package that has the main classes
for the project and that all tends to be in a single package. I also find
myself using a number of different "common" classes in each project. I have
my common classes organized into different categories: panels, error
handling, preferences, utilities, etc. Each category of common classes has
its own package.

Each package used for common classes has a corresponding package for
resource bundles. For example, package com.foo.common.utilities contains
common utility classes. The resource bundles for the classes in this package
are in package com.foo.common.utilities.Resources.

I also have a separate package for the resources used by my main project
classes. If the main project classes are in a package called
com.foo.myproject, the resources for the classes in that package are in a
package called com.foo.myproject.Resources.

I create List, Message and Text resource bundles for each language/locale
that I want to support so I typically have a separate List, Message, and
Text resource bundle for English, French, and German. (On some projects, I
have had separate bundles for English Canada, English US, English UK, French
Canada, French France, German Germany, German Switzerland and German
Austria. But that was just a little demo project where I wanted to practice
using i18n.)

Organizing things this way is very beneficial for my common code; each
common class can support different languages than the others and I only have
to translate phrases that are relevant to that class. But putting all of the
locale-sensitive information for the main project in just three resource
bundles, the List, Message, and Text bundles, means that I have to manage a
lot of different files for the main work of the project. I would not really
want to make a separate resource bundle for each dialog and panel in the
main application but I suppose I could live with that if it was the shop
standard for an employer.

Just my two cents worth; I'm sure other people do things differently!

--
Rhino

I tend to have a one List resource bundle, one Text resource bundle, and one
Message resource bundle for each language/locale that is


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.