Multi-Language support in Flutter

Save

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.

 

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

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

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.

Vincenzo Carrano

Vincenzo Carrano

Administrator, Segshop

Talk to Sales

Global

Live Chat
Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home