|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
The Java platform does not require you to use the sameLocalethroughout your program. If you wish, you can assign a differentLocaleto 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 defaultLocalecorresponds to the locale of the host platform. To determine the defaultLocaleof your Java Virtual Machine, invoke theLocale.getDefaultmethod. You should not set the defaultLocaleprogrammatically 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
Localefor each client is different, what should be theLocaleof the server? Perhaps the server is multithreaded, with each thread set to theLocaleof 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 theLocalemay have changed since the last request.
|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2004 Sun Microsystems, Inc. All rights reserved.