Example usage for com.google.gwt.language.client.translation Translation isTranslatable

List of usage examples for com.google.gwt.language.client.translation Translation isTranslatable

Introduction

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

Prototype

private static native boolean isTranslatable(String langCode) ;

Source Link

Document

Private helper method that actually invokes the underlying javascript to get translatable status of language.

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  ww  . j  a  v  a  2s.com
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);
}