# Îñţérñåţîöñåļîžåţîöñ Sample

This sample shows the use of Google Web Toolkit's internationalization classes. In a truly internationalized application, all strings (including this one) and styles (including the CSS used to style this page), would also be internationalized. Although English is the default language for this sample, it is also localized for French. Append locale=fr to the query string to view the French version.

## NumberFormat

Class `NumberFormat` supports locale-sensitive formatting and parsing of numbers using a flexible pattern-based syntax. In addition to custom patterns, several standard patterns are also available for convenience. See the GWT class reference for details of the pattern syntax.

## DateTimeFormat

Class `DateTimeFormat` supports locale-sensitive formatting and parsing of date and time values, like `NumberFormat`, using a flexible pattern-based syntax. Both custom patterns and standard patterns are supported. See the GWT class reference for details of the pattern syntax.

## Messages

Interface `Messages` provides a way to create strongly-typed parameterized messages that are checked for correctness during compilation. This example interacts with the sample interface `ErrorMessages`, defined as follows:

    public interface ErrorMessages extends Messages {
      String permissionDenied(
                  String username,
                  String securityClearance,
                  String inaccessibleResource);
    }

### Plural Forms

The `Messages` interface also provides support for plural forms, choosing the correct form based on the count. In the example below, note that the English plural forms are included in the source file via annotations.

    @DefaultLocale("en_US")
    public interface MyMessages extends Messages {
      @DefaultMessage("You have {0} trees.")
      @PluralText({"one", "You have one tree."})
      String treeCount(@PluralCount int count);
    }

## Constants

Interface `Constants` makes it possible to localize strings, numbers, and maps of strings onto strings. This example isn't terribly exciting, but it does demonstrate how to localize constants. The labels and colors choices below are provided by the localized implementation of the sample interface `ConstantsExampleConstants`, defined as follows:

    public interface ConstantsExampleConstants extends Constants {
      Map colorMap();
      String favoriteColor();
      String firstName();
      String lastName();
    }

## ConstantsWithLookup

Interface `ConstantsWithLookup` makes it possible to dynamically look up localized values using method names as string keys. This example interacts with the sample interface `Colors`, defined as follows:

    public interface ColorConstants extends ConstantsWithLookup {
      String black();
      String blue();
      String green();
      String grey();
      String lightGrey();
      String red();
      String white();
      String yellow();
    }

## Dictionary

Using the `Dictionary` class, you can lookup localized values within JavaScript objects defined in the host HTML page rather than compiling them into your GWT code. This is useful if your translations change frequently, because your HTML server can emit updated translations into the host page HTML as often as needed. It can also a useful way to integrate a GWT module with existing localized web applications. Note that a dictionary's values depend only on the host page HTML and are not influenced by the GWT `locale` client property. For this example, the JavaScript variable declaration appears in the source for this HTML page. It looks like this:

    var userInfo = {
      name: "Amelie Crutcher",
      timeZone: "EST",
      userID: "123",
      lastLogOn: "2/2/2006"
    };