Sub topic 13
Declaring supported languages on iOS and other platforms
This chapter assumes you have a working gen-l10n setup. That means AppLocalizations.supportedLocales is wired into MaterialApp, and you can run the app on a device or simulator. You should also be comfortable editing XML and property files in the platform folders (ios/, android/, macos/, web/).
Why the platform needs to know
Everything so far lives in Dart. The ARB files, the generated AppLocalizations, and the delegates only exist inside the Flutter engine's view of the app. The operating system knows nothing about them. The OS reads a separate set of metadata from the native app bundle, and it uses that metadata for things such as:
- Which languages the app is listed under in system settings, such as the per-app language screen.
- Which languages the app store shows on the product page.
- Which languages the system considers the app to "speak" when it hands over the user's preferred locales.
- Localization of strings the OS shows on the app's behalf, such as the app name under the icon or permission prompts.
Flutter does not generate this metadata from your ARB files. You declare it yourself, once per platform, and you must keep it in sync when you add a language.
iOS: CFBundleLocalizations
On iOS, the list of supported languages comes from the app bundle. A Flutter project starts with a single development region, usually English. If you add app_es.arb and do nothing else, the Dart side supports Spanish but the bundle still declares only English. The symptoms can include:
- No per-app language entry for the app in the iOS Settings app.
- The App Store listing showing one language.
- The device's Spanish preference not reaching your Dart code on some setups, so the app stays in English.
The fix is to add a CFBundleLocalizations array to ios/Runner/Info.plist. Each entry is a language code:
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>es</string>
</array>The array goes inside the top-level <dict>, next to keys such as CFBundleName. Keep CFBundleDevelopmentRegion as it is. It names the fallback language for the bundle.
You can also add languages through Xcode. Open ios/Runner.xcworkspace, select the Runner project, open the Info tab, and add each language under Localizations. Xcode can create .lproj folders and update the project file. For a Flutter app, the plist entry is the smaller change, and it is easy to review in a pull request.
Script and region codes
Use the same granularity on both sides. If your ARB files are app_en.arb and app_es.arb, list en and es. If you ship app_zh_Hans.arb and app_zh_Hant.arb, the plist needs zh-Hans and zh-Hant. Note that Apple uses hyphens where Flutter file names use underscores.
| Concept | ARB file name | `Info.plist` entry |
|---|---|---|
| Spanish | `app_es.arb` | `es` |
| Simplified Chinese | `app_zh_Hans.arb` | `zh-Hans` |
| Brazilian Portuguese | `app_pt_BR.arb` | `pt-BR` |
Localizing the app name
CFBundleLocalizations only declares languages. To show a different app name per language, add an InfoPlist.strings file for each language through Xcode (File > New > File > Strings File, then localize it). Put the display name in it:
"CFBundleDisplayName" = "Planificador de viajes";Permission prompts work the same way. The usage-description keys, such as NSCameraUsageDescription, can be overridden per language in InfoPlist.strings. The iOS system shows those texts, so Flutter's AppLocalizations cannot translate them.
macOS
A macOS app uses the same mechanism. Add the same CFBundleLocalizations array to macos/Runner/Info.plist. Check that each language code matches an ARB file. As on iOS, the app name and permission strings need InfoPlist.strings files added through Xcode.
Android
Android needs less for the app itself. Flutter reads the device's locale list at runtime, and the Dart side does the matching, so a Spanish ARB file works without an Android declaration. Two situations need extra work.
Per-app language preferences (Android 13 and later)
Android 13 lets users pick a language for a single app in system settings. The app only appears in that list if it declares its languages. Create android/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="es"/>
</locale-config>Then reference it from the <application> element in android/app/src/main/AndroidManifest.xml:
<application
android:label="Trip Planner"
android:localeConfig="@xml/locales_config"
android:icon="@mipmap/ic_launcher">
<!-- activities unchanged -->
</application>Android language tags use hyphens, such as zh-Hans or pt-BR. When a user chooses Spanish for your app, Android changes the locale list the app receives, and Flutter's normal resolution does the rest. Your Dart code needs no change.
Resource filtering
Some projects restrict resource languages in Gradle to shrink the APK, for example with resourceConfigurations or resConfigs. Flutter's own strings are in Dart, so these filters do not remove your translations. They can remove translated native resources that plugins ship, such as strings in an Android library. If you use such a filter, include every language you support.
Localizing the app label
The android:label in the manifest is a native string. To localize it, point it at a string resource (@string/app_name) and add res/values/strings.xml and res/values-es/strings.xml. Flutter does not manage these files.
Web, Windows, and Linux
These platforms take their languages from the browser or the OS settings, and they have no per-app declaration to maintain.
- Web: the browser's language list reaches Flutter, and
supportedLocalesfilters it. Set thelangattribute on the<html>element inweb/index.htmlto your default language. It helps screen readers and search engines before Flutter loads. The browser also uses it for translation prompts. - Windows and Linux: Flutter reads the system language list. You do not need to declare anything for the app to run in Spanish. Installer metadata, such as an MSIX manifest's language list, is a packaging concern outside Flutter.
Checking the result
After you update the metadata, test it on a real or simulated device:
- Change the device language to Spanish and launch the app. The translated strings should appear.
- On iOS, open Settings and scroll to the app. A Language row should be present and list your languages. On Android 13 and later, open Settings > System > Languages > App languages.
- Add a language that you did not declare, such as French, and confirm the app falls back to your default. The fallback logic is covered in the locale resolution chapter.
You can also print what Flutter received. This is a quick way to tell a native declaration problem from a Dart wiring problem:
import 'package:flutter/material.dart';
class LocaleDebugText extends StatelessWidget {
const LocaleDebugText({super.key});
@override
Widget build(BuildContext context) {
final device = WidgetsBinding.instance.platformDispatcher.locales;
final resolved = Localizations.localeOf(context);
return Text('device: $device\nresolved: $resolved');
}
}If device lacks the language you set but the system settings show it, the native declaration is the likely cause. If device contains it but resolved does not, check supportedLocales and your ARB file names.
Common errors
- Underscore instead of hyphen.
zh_Hansin a plist orlocales_config.xmldoes not match. Usezh-Hans. - Declaring a language with no ARB file. The OS offers the language, but the app resolves to the fallback. Users see a language switch that appears to do nothing.
- Forgetting macOS. The iOS plist is updated, but the macOS runner is not.
- Editing
Info.plistwith a stale build. Runflutter cleanor reinstall the app if Settings does not show the change, because the OS caches bundle metadata. - Assuming native strings are translated. Permission prompts and the home screen label do not come from
AppLocalizations.
Exercise
You add app_de.arb and regenerate the code. Widget tests with Locale('de') pass. On an iPhone set to German, the app still shows English, and the Settings app has no Language row for it. What did you probably miss, and what do you add on Android so users on Android 13 can choose German for the app?
Show answer
The CFBundleLocalizations array in ios/Runner/Info.plist does not list de, so the iOS bundle declares only the development language. Add <string>de</string> to that array, and do the same in macos/Runner/Info.plist if you ship macOS. On Android, add <locale android:name="de"/> to res/xml/locales_config.xml, and make sure AndroidManifest.xml references the file with android:localeConfig="@xml/locales_config".
Exercise
Your ARB files are app_en.arb and app_pt_BR.arb. What exact language codes do you write in Info.plist and in locales_config.xml?
Show answer
Use en and pt-BR in both files. The ARB file name uses an underscore, but Apple and Android language tags use a hyphen.