Is there a way I can translate my flutter app for free?

1,105

The best approach would be to get translated data from the backend as it will be a lot faster compared to translating the text at the mobile end.

There is this translator package which you can use to convert the data fetched from the backend.

However, note that your app will become slow when you implement this because you will have to wait for two API calls:

  1. For fetching data from the backend
  2. Uploading this fetched data & then getting translations back

The translator package makes use of Google Translator to translate text into any language that you want.

void main() async {
  final translator = GoogleTranslator();

  final input = "Здравствуйте. Ты в порядке?";

  translator.translate(input, from: 'ru', to: 'en').then(print);
  // prints Hello. Are you okay?
  
  var translation = await translator.translate("Dart is very cool!", to: 'pl');
  print(translation);
  // prints Dart jest bardzo fajny!

  print(await "example".translate(to: 'pt'));
  // prints exemplo
}

The simple use case example mentioned in the package.

Share:
1,105
Srajan Gupta
Author by

Srajan Gupta

Updated on December 26, 2022

Comments

  • Srajan Gupta
    Srajan Gupta over 1 year

    I am making a flutter app that fetches data from a database using an API. The client wants me to add multilanguage support, so is there a way with which I can change the language of the whole app. Also the data that is being fetched from database needs to be translated. So it would be better if the data is translated before being displayed. Thank you.

    • Giacomo Catenazzi
      Giacomo Catenazzi over 3 years
      Do no trust automatic translators. In my opinion, they reduce the quality of an app: quality is so bad (especially short texts). Really, when one see such translation in an app..it just think people do no care about your culture. In any case, you are a programmer and not a translator. Tell client you can support translation, but they should provide translations. Keep professionalism and put boundaries (it helps you to increase your rates).