List of usage examples for com.google.gwt.language.client LanguageUtils loadTranslation
public static void loadTranslation(Runnable onLoad)
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./*from ww w . jav a2s . c o m*/ */ 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); } }); }