GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing javaee.github.io — Java Platform Localization Classes

Java Platform, Enterprise Edition (Java EE) 8
The Java EE Tutorial

Previous Next Contents

Java Platform Localization Classes

In the Java platform, java.util.Locale (http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html) represents a specific geographical, political, or cultural region. The string representation of a locale consists of the international standard two-character abbreviation for language and country and an optional variant, all separated by underscore (_) characters. Examples of locale strings include fr (French), de_CH (Swiss German), and en_US_POSIX (English on a POSIX-compliant platform).

Locale-sensitive data is stored in a java.util.ResourceBundle (http://docs.oracle.com/javase/7/docs/api/java/util/ResourceBundle.html). A resource bundle contains key-value pairs, where the keys uniquely identify a locale-specific object in the bundle. A resource bundle can be backed by a text file (properties resource bundle) or a class (list resource bundle) containing the pairs. You construct a resource bundle instance by appending a locale string representation to a base name.

The Duke’s Bookstore application (see Chapter 60, "Duke’s Bookstore Case Study Example") contains resource bundles with the base name messages.properties for the locales de (German), es (Spanish), and fr (French). The default locale, en (English), which is specified in the faces-config.xml file, uses the resource bundle with the base name, messages.properties.

For more details on internationalization and localization in the Java platform, see http://docs.oracle.com/javase/tutorial/i18n/index.html.


Previous Next Contents
Oracle Logo  Copyright © 2017, Oracle and/or its affiliates. All rights reserved.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.