As the world becomes more connected, mobile app developers need to ensure that their apps can cater to a global audience. One crucial aspect of this is providing support for multiple languages. In this article, we'll guide you through the process of enabling multi-language support in a Flutter app, allowing you to increase the accessibility of your app to a wider range of users. Let's dive in and learn how to make your app more inclusive!
Configuration
1. Folder and File Setup
Begin by creating the necessary folder and file structure for your Flutter project. The structure should be similar to the following:

2. Pubspec.yaml Configuration
Make sure to add flutter_localizations and intl dependencies to your pubspec.yaml file for Flutter's built-in localization support, and intl helps with internationalization.
Add the language assets file to pubspec.yaml as well:
Create Language Files
Add language-specific JSON files to the assets/locales folder. A few examples include:
en.json
es.json
There will be key-value pairs in these JSON files, where the key is a unique identifier and the value is the translated string.
App Localization Logic
The app_localization.dart file handles app localizations, loading the correct language file based on the user's locale and providing a method for string translation.
The class initializes with the given locale, loads the associated language file, and delivers translated strings via a method (translate).
App Localization Delegate
The app_localization_delegate.dart file defines the localization delegate that Flutter uses to manage and load localized strings.
It checks if a given locale is supported, loads the localized strings, and ensures that the delegate does not need to be reloaded.
Integration in main.dart
In the main.dart file, initialize the delegates and supported languages to set up localization for the entire app.
The localizationsDelegates list includes the custom AppLocalizationsDelegate, along with Flutter's default delegates for material, widgets, and Cupertino (iOS-style) localization. The supportedLocales list specifies the languages supported by the app.
Accessing Translated Text in Code
You can use the following code snippet to access language text keys in Flutter:
Replace the argument inside 'translate' with the desired key to fetch the corresponding translated text.
Testing Multi-Language
To test the language-switching functionality, follow these steps:
- Please go to the settings of your mobile device and find the option to change your language and region settings.
- To change the language of the system from English to Spanish.
- When you return to the app, you will notice that it now supports the Spanish language.
To ensure that your multi-language support implementation is effective, follow these steps.

You can download the source code from the GitHub link provided below.
Source code: https://github.com/socialmad/flutter_localization_demo
Conclusion
Enabling multi-language support in your Flutter app is a crucial step towards providing a better user experience for a diverse audience. The steps outlined above provide an easy way to integrate localization into your app, making it accessible to users worldwide. You can further customize and expand this foundation as per your localization needs. Thank you for reading this article! If you found it helpful, please connect with me on LinkedIn.