Multi language setup

There are several languages already added in the app. You will find them in the assets folder.

The files are named using the language code meaning the bn.json is for Bangla language, en.json is for English. So if you need another language you can create the file like this.

The file will contain items like this. In the map the key must be the same but the values will be changed to your desired language. 

After saving the file here in the assets folder. Open the file named supported_locales.dart which is located in lib\translations\supported_locales.dart.

Open the folder and you will see this.

Add the new locale here using the same format.

Then you have to run a command in the terminal.

flutter pub run easy_localization:generate -S “assets/translations” -O “lib/translations”

Make sure you are in the cart folder in the terminal.

Then you are good to go with the new language!

Was this page helpful?

Leave Comment