Example usage for com.google.gwt.language.client.translation LangDetCallback LangDetCallback

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

Introduction

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

Prototype

LangDetCallback

Source Link

Usage

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

License:Apache License

/**
 * Creates a "Detect" button to do language detection.
 *
 * @return button//from  w w w. j  ava 2s  .  c  o m
 */
private Button createLanguageDetectionButton() {
    Button langDetButton = new Button("Detect");
    langDetButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Translation.detect(inputTextArea.getText(), new LangDetCallback() {
                @Override
                protected void onCallback(LangDetResult result) {
                    outputDiv.setText("Detected language: " + result.getLanguage() + ", Confidence: "
                            + result.confidence());
                }
            });
        }
    });
    return langDetButton;
}