31
Internationalization

Internationlization

Embed Size (px)

Citation preview

Page 1: Internationlization

Internationalization

Page 2: Internationlization

What is internationalization? the process of creating applications which can adapt and adjust to various countries, languages, regions.

I18N

Page 3: Internationlization

What is localization? the process of adapting an application for a specific language or country by addition of locale-specific components and translation of text.

L10N

Page 4: Internationlization

Why need internationalization?

Page 5: Internationlization

Why need internationalization? Difference: - Language

- Currency

- Date and time

Page 6: Internationlization

Alternatives to solve the Problem? Develop product

Translate product

Page 7: Internationlization

Benefits of I18N and L10N No hard coding

No recompilation

Localized quickly

Page 8: Internationlization

Unicode provide a unique number for every character irrespective of platform, program or language.

Unicode is a 16-bit character encoding

Page 9: Internationlization

Significance of Unicode Java platform uses Unicode as its native character encoding.

\Uxxxx : X : hexadecimal digit

Page 10: Internationlization

Internationalization Process

Page 11: Internationlization

Properties file MessageBundle.properties

MessageBundle_fr_FR.properties

MessageBundle_de_DE.properties

Page 12: Internationlization

Locale Constructors:

public Locale(String language, String country)

public Locale(String language)

Locale usLocale = new Locale(“en”,”us”)

Page 13: Internationlization

Methods public static Locale getDefault()

public final String getDisplayCountry()

public final String getDisplayLanguage()

Page 14: Internationlization

Resource Bundle Localized or translated into different languages

Handled for multiple locales at the same time

Supported for more locales later

Page 15: Internationlization

Using Resource Bundle ResourceBundle getBundle(String, Locale)

Page 16: Internationlization

Fetching the text from Resource Bundle public final String getString(String key)

Page 17: Internationlization

Fetching the text from Resource Bundle public abstract Enumeration <String> getKeys()

Page 18: Internationlization

Internationalization Elements

Page 19: Internationlization

Component Captions

Caption text

Dates

Numerals

Percentage

Page 20: Internationlization

Need for Formatting?

12345678

US 12,345,678

EU 12.345.678

Page 21: Internationlization

NumberFormat class

getNumberInstance()

getCurrencyInstance()

getPercentInstance()

format()

Page 22: Internationlization

DateFormat class

DateFormat getDateInstance (style, locale)

Page 23: Internationlization

Formatting Message

Page 24: Internationlization

It is not always possible to create a grammatically correct sentences with concatenation of phrases and variables.

Page 25: Internationlization

So we need MessageFormat.

Page 26: Internationlization

Steps for MessageFormat. Identify variables

Create template

Create object array

Create instance

Apply and Format

Page 27: Internationlization
Page 28: Internationlization
Page 29: Internationlization
Page 30: Internationlization
Page 31: Internationlization