To localize the app name in a Flutter project, you'll need to modify the Android and iOS sections of your code. This process is not related to Flutter itself, but rather to the specific platforms your app is running on.
To begin, you'll need to add translations of your app name for each language you want to support in both the Android and iOS sections of your project. These translations should be included in the appropriate resource files for each platform (e.g., strings.xml
for Android and InfoPlist.strings
for iOS).
It's important to note that the app name will change based on the user's device language, not the app's language. So if a user switches their device's language setting from English to French, for example, the app name will automatically update to its French translation.
By following these steps, you can ensure that your Flutter app's name is properly localized and easily accessible to users in their preferred language.
Navigate to the android\app\src\main\res\values
.
Add file strings.xml
inside the values
folder.
Update the strings.xml
file.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="appName">App name default locale</string>
</resources>
Copy values
folder for each locale you want to add and update strings.xml
files with the translated app name.
|--...
|--values
| |--...
| |--strings.xml
|--values-de
| |--...
| |--strings.xml
|--values-fr
| |--...
| |--strings.xml
Update android:label
within android\app\src\main\AndroidManifest.xml
file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutter_demo_app_name">
<application
android:label="@string/appName"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<!-- Other config... -->
</application>
</manifest>
Run the app and see how app name changes when device language changes.
Update CFBundleDisplayName
within ios\Runner\Info.plist
file.
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
Create a new directory within the Runner
directory called Resources
.
Within the Resources
directory, create a new file called InfoPlist.strings
. This file will contain the translations of your app name.
For each locale you want to support, create a new directory within the Resources
directory with the name of the language (e.g., en.lproj
for English).
Within each language directory, create a new file called InfoPlist.strings
and add the following code:
"CFBundleDisplayName" = "Your translated app name";
Run the app and see how app name changes when device language changes.