简体   繁体   English

在 Android 中将英文文本翻译成印地语

[英]Translate English Text to Hindi in Android

I want to convert a text in English to Hindi and display it in the TextView.I followed the following URL http://android-er.blogspot.com/2009/10/androidtranslate-using-google-translate.html but it dosen't seems to work. I want to convert a text in English to Hindi and display it in the TextView.I followed the following URL http: //android-er.blogspot.com/2009/10/androidtranslate-using-google-translate.html but it dosen似乎不起作用。 Is there any other method to do it?Help me out.有没有其他方法可以做到这一点?帮帮我。

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.read_view);
    mTts = new TextToSpeech(this,this);
    try {
        setTranslate();
    } catch (Exception e) {
        e.printStackTrace();
    }

}

private void setTranslate() throws Exception {
 String OutputString = Translate.execute("hello",
         Language.ENGLISH, Language.HINDI);
 TextView tv = (TextView) findViewById(R.id.translate);
 tv.setText(OutputString);
}

Here I am trying to display hindi text in the TextView id "translate"在这里,我试图在 TextView id "translate" 中显示印地语文本

Microsoft Bing Translator offers a translator for this english-hindi and its completely free for a limited searches. Microsoft Bing Translator 为这种英语-印地语提供翻译器,并且对于有限的搜索完全免费。 http://www.microsoft.com/web/post/using-the-free-bing-translation-apis . http://www.microsoft.com/web/post/using-the-free-bing-translation-apis

make sure your application does have internet permission确保您的应用程序确实具有Internet 权限

android.permission.INTERNET

add google translate api jar ie google.api.translate-java-0.90.jar添加谷歌翻译 api jar 即 google.api.translate-java-0.90.Z6145044DBF4329492

Also check this client api it comes useful some times when u want to handle certain events and requests with ease另请检查此客户端 api当您想轻松处理某些事件和请求时,它有时会很有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM