How to use Google Translate API in my Java application?

后端 未结 5 1001
攒了一身酷
攒了一身酷 2020-11-27 12:58

If I pass a string (either in English or Arabic) as an input to the Google Translate API, it should translate it into the corresponding other language and give the translate

5条回答
  •  一整个雨季
    2020-11-27 13:23

    Use java-google-translate-text-to-speech instead of Google Translate API v2 Java.

    About java-google-translate-text-to-speech

    Api unofficial with the main features of Google Translate in Java.

    Easy to use!

    It also provide text to speech api. If you want to translate the text "Hello!" in Romanian just write:

    Translator translate = Translator.getInstance();
    String text = translate.translate("Hello!", Language.ENGLISH, Language.ROMANIAN);
    System.out.println(text); // "Bună ziua!" 
    

    It's free!

    As @r0ast3d correctly said:

    Important: Google Translate API v2 is now available as a paid service. The courtesy limit for existing Translate API v2 projects created prior to August 24, 2011 will be reduced to zero on December 1, 2011. In addition, the number of requests your application can make per day will be limited.

    This is correct: just see the official page:

    Google Translate API is available as a paid service. See the Pricing and FAQ pages for details.

    BUT, java-google-translate-text-to-speech is FREE!

    Example!

    I've created a sample application that demonstrates that this works. Try it here: https://github.com/IonicaBizau/text-to-speech

提交回复
热议问题