Adding Language Support

  1. Home
  2. Docs
  3. Adding Language Support

Adding Language Support

How to add support for a specific language ?

1-Create the JSON file:

Navigate to assets/translations and create a new JSON file, the name of the file should follow either of these formats: 
1- {languageCode}.json
example: fr.json
2- 
{languageCode}{countryCode}.json
example: fr-ca.json

it should look similar to this screenshot:

2-Translate the original text:

After you have created the file, you should have a key-value pairs, start by adding the key as the default english text, and the value should be the translated text, it should look something similar to this:

3- Add the language to supported locales by the app:

Navigate to lib/main.dart , Inside the EasyLocalization widget you should look for supportedLocales, this is a list of every language that your app supports, you need to add your locale to the list, it should look like this:

iOS configuration for the new language:

Open the app in xcode, open Runner.xcodeproj , navigate to info tab and scroll down to Localizations section, press the plus button and select your language and press finish, it should look similar to these screenshots:


And that’s it, the app will follow the device prefered language if it’s supported, and will always fallback to English if the key/value is missing from the JSON file.