- Add
<localeName>.arb
file inassets/l10n
. - Translate all fields in
en.arb
file. - run
flutter gen-l10n
in library root path. - Add new locale to
appSupportedLocales
inlib/common/consts.dart
const appSupportedLocales = [
Locale.fromSubtags(languageCode: 'en'),
Locale.fromSubtags(languageCode: 'zh'),
// Add new locale here
];
Use format
values-xx-rXX
instead ofvalues-xx-XX
orvalues-xx_XX
which including acountryCode
.
- Add your locale in
resourceConfigurations
located inandroid/app/build.gradle
defaultConfig {
resourceConfigurations += ["en", "zh", <your_language_code>]
}
- Create new folder at
android/app/src/main/res/values-<your_language_code>
and create new filestrings.xml
with the following code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- add translated app name here -->
<string name="appName">translated_app_name</string>
</resources>
- Add your locale in
locales_config.xml
located inandroid/app/src/main/res/xml/locales_config.xml
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en" />
<locale android:name="zh" />
<!-- Add your locale here -->
<!-- <locale android:name="xx" /> -->
</locale-config>
- Add Localization from
Project -> Runner -> Info
- Select
InfoPlist.strings
and pressFinish
- select
InfoPlist.strings
in left panel, expand tree and selectInfoPlist.strings (XXXXX)
- rename
CFBundleDisplayName
andCFBundleName
value to translatted string.
CFBundleDisplayName = "Table Habit";
CFBundleName = "Table Habit";