I have a string obtained from EditText.
String test= et.getText.toString();
test=" My name is john tokest";
After that I have spinner with different language like, English, Chinese, French, Hindi.
If I choose French, I want to display in text view in French translate test string.
like this: Mon nom est john tokest
Is it possible in android? or not?
Note: I have done this successfully if I have created value-fr folder in res and included respective string, but I want to do this at run time.
Add google translation jar in your project. And then you can use it like this:
String test="My name is john tokest";
try {
String translatedText = Translate.execute(test, Language.ENGLISH, Language.FRENCH);//You can pass params as per text input and desired output.
System.out.println(translatedText)
} catch (Exception e) {
e.printStackTrace();
}
Reference article
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With