Have you ever downloaded an app from the App Store only to find that its display name is not in your native language? It can be a bit jarring and make the app feel less accessible. As an iOS developer, you have the power to create a more inclusive experience for users worldwide by localising your app's display name. In this article, we'll explore how you can achieve this in your iOS app using Swift.
Before we dive into localisation, let's quickly understand what an app's display name is. The app display name is the name that appears on the user's home screen and under the app icon. By default, this name is set in the app's Info.plist file using the
CFBundleDisplayName key. However, this value is usually static and does not change based on the user's language preferences.
To localise the app's display name, we need to provide different display name values for each supported language. This can be achieved by utilising the localisation capabilities of iOS.
Start by creating a new strings file. You can do this by selecting the project in Xcode's Project Navigator, then going to File -> New -> File... and selecting Strings File.
Give the string file the name "InfoPlist.strings". Make sure to add the languages you want to localize to your project and also check the boxes for each language for this new file. You can read more about this here.
Open each strings file and add a key-value pair for the app's display name. The key should be
CFBundleDisplayName and the value should be the desired display name in the respective language. For example:
1"CFBundleDisplayName" = "My Awesome App";
To verify that your localisation is working correctly, you can follow these steps:
Change your device or simulator's language and region settings to one of the supported languages.
Build and run your app. You should now see the app's display name in the selected language on the home screen.
Bullet Point Summary: