Java I18n 简明教程

Java Internationalization - Overview

Internationalization

国际化或 I18N是指应用程序能够用多种不同语言为用户提供服务的功能。Java 对国际化具有内置支持。Java 还提供数字、货币的格式化以及相应地调整日期和时间。

Internationalization or I18N refers to the capability of an Application to be able to serve users in multiple and different languages. Java has in-built support for Internationalization. Java also provides formatting of numbers, currencies and adjustment of date and time accordingly.

Java 国际化有助于使 Java 应用程序处理不同的语言、数字格式、货币、特定区域时间格式化。

Java Internationalization helps to make a java application handle different languages, number formats, currencies, region specific time formatting.

Localization

本地化或 L10N是指应用程序的适应性,即应用程序如何适应特定语言、数字格式、日期和时间设置等。

Localization or L10N is the adaptability of an application that is how an application adapts itself with a specific language, number formats, date and time settings etc.

为了实现本地化,Java 应用程序应实现国际化。

A java application should be internationalized in order to be able to localize itself.

Culturally Dependent Information

以下信息项通常随不同时区或文化而变化。

Following information items often varies with different time zones or cultures.

  1. Messages

  2. Date

  3. Time

  4. Number

  5. Currency

  6. Measurements

  7. Phone Numbers

  8. Postal Addresses

  9. GUI labels

Internationalization Classes

Java 有一组内置类可帮助应用程序实现国际化。这些类如下所示:

Java has a set of built-in classes which help in internationalization of an application. These classes are following −

Sr.No.

Class & Description

1

Locale Represents a language along with country/region.

2

ResourceBundle Contains localized text or objects.

3

NumberFormat Use to format numbers/currencies as per the locale.

4

DecimalFormat Use to format numbers as per customized format and as per locale.

5

DateFormat Use to format dates as per locale.

6

SimpleDateFormat Use to format dates as per customized format and as per locale.