Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
The Java platform does not require you to use the sameLocale
throughout your program. If you wish, you can assign a differentLocale
to every locale-sensitive object in your program. This flexibility allows you to develop multilingual applications, which can display information in multiple languages.However, most applications are not multi-lingual and their locale-sensitive objects rely on the default
Locale
. Set by the Java Virtual Machine when it starts up, the defaultLocale
corresponds to the locale of the host platform. To determine the defaultLocale
of your Java Virtual Machine, invoke theLocale.getDefault
method. You should not set the defaultLocale
programmatically because it is shared by all locale-sensitive classes.Distributed computing raises some interesting issues. For example, suppose you are designing an application server that will receive requests from clients in various countries. If the
Locale
for each client is different, what should be theLocale
of the server? Perhaps the server is multithreaded, with each thread set to theLocale
of the client it services. Or perhaps all data passed between the server and the clients should be locale-independent.Which design approach should you take? If possible, the data passed between the server and the clients should be locale-independent. This simplifies the design of the server by making the clients responsible for displaying the data in a locale-sensitive manner. However, this approach won't work if the server must store the data in a locale-specific form. For example, the server might store Spanish, English, and French versions of the same data in different database columns. In this case, the server might want to query the client for its
Locale
, since theLocale
may have changed since the last request.
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.