Step by Step:

  1. Tạo ra 1 app flutter:

tạo bằng các câu lệnh : “flutter create <tenthumuc>

  1. thực hiện add các thư mục của flutter_localizaton

Lệnh chạy trên terminal:

flutter pub add flutter_localizations --sdk=flutter
flutter pub add intl:any

Tiến hành kiểm tra trong thư mục pubspec.yaml

dependencies:
# Other dependencies...flutter_localizations:
    sdk: flutter
  intl: any
  1. Trong thư mục pubspec.yaml:
flutter:
	  generate:true# Other config...
  1. Trong thư mục root của flutter, tạo file l10n.yaml, add thêm các đường dẫn sau:

arb-dir: lib/l10n template-arb-file: intl_en.arb
output-localization-file: app_localizations.dart

  1. Nhưng nếu như thực hiện trên app iOS thì cần cấu hình trong file  ios/Runner/Info.plist
<key>CFBundleLocalizations</key>
<array>
<string>ar</string>
<string>en</string>
<string>es</string>
</array>
  1. Nhớ cấu hình trong các file