Start a Project

Multi-Language support in Flutter

Multi-language support is an important feature to globalize the application and increase the user audience. Language is a factor that connects people and the same principle is applied to app development also. When a customer sees their native language, it creates an emotional bond with the app.

FACT

English continues to represent the most common language on the Internet, almost 75% of app users do not speak English, which leaves a considerable big market available for multilingual apps.

Transform your app idea into a reality with our Flutter app development services.

Flutter by default only provides the US English localization. For supporting other languages, the application must specify additional properties and include the package called flutter_localizations. As of November 2020, this package supports 78 languages.

Check the below code for practical implementation.

Add the below package as a dependency to your pubspec.yaml file:

In the next step, import the flutter_localizations library and specify localizationsDelegates and supportedLocales for MaterialApp:

Adding the localized messages for multi-language support

Once the flutter_localizations package is added, use the following instructions to add localized text to your application.

  • Add the intl package to the pubspec.yaml file:

  • Enable the generate flag in the pubspec.yaml file:

  • Add the new yaml file to the root directory of the Flutter project called l10n.yaml with the following content:

  • In ${FLUTTER_PROJECT}/lib/l10n, add the app_es.arb template file.

  • Now after running the app. A file will be generated in ${FLUTTER_PROJECT}/flutter_gen/gen_l10n after which we will start using the localization in the app.

In this way, we can support multi-languages in flutter apps.

Refernece

Exit mobile version