avatarGrace Huang

Summary

The web content provides a guide on localizing the app name in Xcode 15 using the new String Catalog feature.

Abstract

The article introduces the process of localizing an app's name in Xcode 15 through the use of String Catalog. It highlights the convenience of String Catalog for managing string translations and outlines the steps to create an InfoPlist String Catalog file for translating the app name. The guide includes adding localized string values for CFBundleDisplayName and CFBundleName for different languages, such as English and Simplified Chinese. It also explains how to verify the localized app name by changing language settings in the iOS Simulator, noting that this method differs from testing strings inside the app, which can be done through editing the scheme in Xcode.

Opinions

  • The author suggests that the String Catalog simplifies the localization process, implying it is an improvement over previous methods.
  • The author promotes their latest book, "macOS App Development: The SwiftUI Way," indicating a belief in its relevance and value to the reader.
  • The inclusion of screenshots and a video link suggests a preference for visual aids to complement the written instructions.
  • The mention of a WWDC23 video as the best source for official documentation implies that the author values up-to-date and authoritative resources.
  • The author expresses gratitude to a reader for providing a helpful tip, indicating an appreciation for community engagement and knowledge sharing.

How to Localize the App Name in Xcode 15 using String Catalog

Xcode 15 introduced String Catalog to simplify the process and management of string translation (see the WWDC notes).

You’ve probably seen the magic of String Catalog in localized strings inside the app. It is super convenient.

If you are wondering how you can localize the app name, you’ve come to the right place.

(My latest book “macOS App Development: The SwiftUI Way” is now available. Grab your copy today!)

Create the InfoPlist String Catalog

You should already have a file named Localizable.strings, which serves as a String Catalog file for translating all the strings within the app.

Localizable.strings

To localize the app name, we need to do something else. Now create a new String Catalog file called InfoPlist.

Creating a new String Catalog
Name the file “InfoPlist”

Add Localized String Values for CFBundleDisplayName and CFBundleName

Now, add the translations to the file named InfoPlist.xcstrings that we just created.

The empty InfoPlist.xcstrings

CFBundleDisplayName is the user-visible name of the app, while CFBundleName is the internal name used to identify the app’s bundle.

English is my base language, so I’ll start by adding both values to the String Catalog.

Filling CFBundleDisplayName and CFBundleName in English

Simplified Chinese is another language for my app, so I’ll add the translated values to the String Catalog.

Filling CFBundleDisplayName and CFBundleName in Chinese

Build and Verify

Now we can test it in the Simulator. After building, you might notice that the app name appears in English.

App name is still in English (the part highlighted in yellow)

Navigate to Settings -> General -> Language & Region and move the target language (Simplified Chinese) to the top of the list.

Settings -> General -> Language & Region

After the language setting changes, the Simulator will reboot itself. Then go back Home, and you should be able to see the Chinese version of the app name. ✌️

App name is in Simplified Chinese now

You may notice that to test the strings inside the app, we don’t need to change settings. Instead, we just need to edit the scheme inside Xcode. However, you cannot verify the app name translation using this method.

Hope it helps! If it is not clear, you can also check out the video here:

In case you are wondering where to find the official documentation about App Name Localization using String Catalog, the best source is from this WWDC23 video (h/t to a kind reader for sending me this.)

Xcode
String Catalog
Localization
Swiftui
iOS App Development
Recommended from ReadMedium