Example usage for com.google.gwt.language.client.translation Language ENGLISH

List of usage examples for com.google.gwt.language.client.translation Language ENGLISH

Introduction

In this page you can find the example usage for com.google.gwt.language.client.translation Language ENGLISH.

Prototype

Language ENGLISH

To view the source code for com.google.gwt.language.client.translation Language ENGLISH.

Click Source Link

Usage

From source file:com.google.gwt.language.sample.hellolanguage.client.TranslationDemo.java

License:Apache License

/**
 * Populates list boxes with source and destination languages.
 *///w w  w.  j  a  v a2 s.  co  m
private void populateListBoxes() {
    int englishIndex = 0;
    int spanishIndex = 0;
    int iter = 0;

    // Populate source & destination language list boxes.
    for (Language lang : Language.values()) {
        if (!Translation.isTranslatable(lang)) {
            continue;
        }

        sourceLanguages.addItem(lang.toString());
        destinationLanguages.addItem(lang.toString());
        if (lang == Language.ENGLISH) {
            englishIndex = iter;
        } else if (lang == Language.SPANISH) {
            spanishIndex = iter;
        }
        ++iter;
    }

    // Select English as default source and Spanish as default destination
    // languages.
    sourceLanguages.setSelectedIndex(englishIndex);
    destinationLanguages.setSelectedIndex(spanishIndex);
}