Example usage for com.google.gwt.language.client LanguageUtils loadTransliteration

List of usage examples for com.google.gwt.language.client LanguageUtils loadTransliteration

Introduction

In this page you can find the example usage for com.google.gwt.language.client LanguageUtils loadTransliteration.

Prototype

public static void loadTransliteration(Runnable onLoad) 

Source Link

Document

Call this method to load Transliteration API before using the API methods.

Usage

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

License:Apache License

/**
 * The onModuleLoad() method is called when the body of the document is
 * finished loading. The JavaScript APIs are not loaded unless they were
 * included in the body of the .html file. Use the LanguageUtils.loadXXX()
 * methods to load them after the app starts, but before any API calls are
 * made./* w w w  . j a  v a  2  s  . c  om*/
 */
public void onModuleLoad() {

    final TabPanel demoTabPanel = new TabPanel();
    demoTabPanel.getDeckPanel().setPixelSize(Window.getClientWidth() - 30, DEMO_PANEL_HEIGHT);
    RootPanel.get().add(demoTabPanel);

    Window.addResizeHandler(new ResizeHandler() {
        public void onResize(ResizeEvent event) {
            demoTabPanel.getDeckPanel().setPixelSize(Window.getClientWidth() - 30, DEMO_PANEL_HEIGHT);
        }
    });

    final VerticalPanel transDemoPanel = new VerticalPanel();
    transDemoPanel.add(loadingLabel());

    final VerticalPanel langDetectDemoPanel = new VerticalPanel();
    langDetectDemoPanel.add(loadingLabel());

    final VerticalPanel translitDemoPanel = new VerticalPanel();
    translitDemoPanel.add(loadingLabel());

    demoTabPanel.add(transDemoPanel, "Translation demo");
    demoTabPanel.add(langDetectDemoPanel, "Language detection demo");
    demoTabPanel.add(translitDemoPanel, "Transliteration demo");
    demoTabPanel.selectTab(0);

    LanguageUtils.loadTranslation(new Runnable() {
        public void run() {
            transDemoPanel.clear();
            transDemoPanel.add(new TranslationDemo());

            langDetectDemoPanel.clear();
            langDetectDemoPanel.add(new LanguageDetectionDemo());
        }
    });

    LanguageUtils.loadTransliteration(new Runnable() {
        public void run() {
            translitDemoPanel.clear();
            TransliterationDemo translitDemo = new TransliterationDemo();
            translitDemoPanel.add(translitDemo);
        }
    });
}