0

Just want to transliterate English word to Gujarati word like a lot of keyboard apps already doing it. For example: When you type "Hello", it gets automatically transliterated to Gujarati word "હેલો" in keyboard suggestions. Couldn't find it in android documentation.

Tried some workaround here but it didn't work. How to achieve this without third party apis?

PS: I want to transliterate like "Pay" to "પે"(pronounced as Pay also means Pay) Guajarati(Regional language in India) word, not looking for translation which gives a result like "ચૂકવણી"(pronounced as Chukavni means pay).

AskQ
  • 4,215
  • 7
  • 34
  • 61
  • Com'mon! Keyboard apps are already doing it. There is no official docs AFAIK. How do they do? – AskQ Aug 12 '19 at 06:49

2 Answers2

1

Google providing API for translation purpose. You can use Translation Client Library to transate English to Gujarati. For more refer this link

Add this gradle to your project

compile 'com.google.cloud:google-cloud-translate:1.85.0'

This is the sameple code to translate text.

Translate translate = TranslateOptions.getDefaultInstance().getService();

    // The text to translate
    String text = "Hello, world!";

    // Translates some text into Russian
    Translation translation =
        translate.translate(
            text,
            TranslateOption.sourceLanguage("en"),
            TranslateOption.targetLanguage("ru"));


    System.out.printf("Text: %s%n", text);
    System.out.printf("Translation: %s%n", translation.getTranslatedText());
Prayag Gediya
  • 1,078
  • 2
  • 11
  • 20
  • Hey @TakeInfo I want to transliterate like "Pay" to "પે" Guajarati(Regional language in India) word, not looking for translation which gives a result like "ચૂકવણી". – AskQ Aug 09 '19 at 11:27
  • Google also had transliterate API but it was deprecated see this https://developers.google.com/transliterate/v1/getting_started – Prayag Gediya Aug 09 '19 at 11:44
  • Yes. But how other keyboard apps provide transliterated strings suggestions while typing without internet(Offline), is what I'm looking for. There must be functions/classes in android docs for this functionality. Programatically is there a similar solution like this character mapping ?https://github.com/sanskrit/sanskrit/blob/master/sanskrit/transliterate/sanscript.py – AskQ Aug 09 '19 at 13:23
0

Please look into this link and select either the Translation API or AutoML Translation. There is a free user subscription but you can pay to scale accordingly.

Kaustubh J
  • 742
  • 8
  • 9