简体   繁体   中英

Modifying an existing Flutter app to make it Multilingual

I have a full-fledged working Flutter app. Now, I want it to support multiple languages, such as Spanish, Hindi, Urdu, etc. (primarily Indian Languages which are available in Google Translate).

I have searched about this, but all of them mention about "arb files" in which I believe, I have to manually write each and every translated string of the whole app.

I would like to build a package with a class (or just a method) which may require 2 parameters, string and the locale in which translation is required.

Kindly suggest me the best way to achieve it and how can I do it. A link to tutorial would be appreciated.

Flutters own step by step walkthrough to i18n is literally the first result that pops up when you put "Flutter localization" into Google.

https://docs.flutter.dev/development/accessibility-and-localization/internationalization

If for some reason you don't want .arb files, you can roll your own. But be prepared that you will find out along the way what is missing and ending up with a home-brewn solution that is worse than Flutters own to achieve the same thing.

There is no magic function to translate text. Even if you could translate on the fly with a translation service, translation services have become really good in recent years, but they (as any human you could hire) are only as good as the context they get. If they get only single words or half sentences, as is common in an app with headlines and buttons, the result will be horrible. As if you just put every single word into a dictionary. That is not translation. It will feel artificial and laughable.

So... give the existing packages a try. Start with Flutters. It might seem complicated, but it's complicated for a reason.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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