๐ Localizing An App with a String Catalog ๐
Try the all NEW RevenueCat Paywalls builder today!
Try the beta for the new highly flexible, natively rendering Paywall UI framework from RevenueCat. With RevenueCat Paywalls you can remotely configure and edit your entire paywall view without waiting on App Review.
This message is brought to you by a sponsor who helps keep this content free for everyone. If you have a moment, check them out โ your support means a lot!
Welcome to issue #46 of the iOS Coffee Break Newsletter ๐ฌ and to the 9th edition of the "Building a Newsletter App" series.
Last week, I showed you how to handle deep links from notifications in my newsletter app, ensuring users land on the issue detail page when tapping push notifications of a certain type.
This week, I will guide you through localizing the newsletter app using a String Catalog! Localization is key to making your app accessible to a global audience.
Before Xcode 15, managing translations with multiple .strings
and .stringsdict
files was tedious and error-prone.
Mistakes could easily break your build.
Now, with Xcode 15 or higher, Apple has introduced String Catalogs, a streamlined and user-friendly way to handle localization efficiently.
Let's explore how to use this powerful new tool to make your app speak different languages!
The Plan
The goal is to localize the app into English and Portuguese, but the process applies to any language. Here is the plan:
- Add a String Catalog to the project
- Include new languages in the project settings
- Add localizable text to the catalog
- Handle pluralization for different cases
Adding a String Catalog to the Project
To add a string catalog to your project, go to File
> New
> File from Template
. In the pop-up window, select your platform, type "string catalog" in the search bar, choose String Catalog, and click Next
.
You can keep the default name as Localizable. Pick a save location, and click Create
to finalize.
Adding a Language to your Project
To make the app support multiple languages, you need to add additional languages to your project.
Select the string catalog in the Project Navigator, then click the (+)
button at the bottom of the string catalog editor and choose the language you want to include.
In my case, I am adding Portuguese as the additional language.
Adding the Localizable text to the String Catalog
Xcode keeps your string catalog updated with your app's localizable content each time you build the project.
To populate it, go to Product > Build
, and Xcode will automatically detect and add localizable strings.
You can monitor the translation progress for each language by checking the indicator next to its name in the String Catalog.
Adding Pluralizations
String catalog simplifies the localization of word variations.
Pluralization is now easier than ever - just right, click a row and select "Vary by Plural"
, which adds One
and Other
options.
You can also vary text based on the device type, which is especially useful when supporting multiple platforms.
๐ค Wrapping Up
That is a wrap on this week's issue, where I explored localization with Xcode String Catalogs. I truly believe String Catalogs are a well-designed addition that transforms the once tedious localization process into something much more streamlined and enjoyable to use!
Next week, I will be stepping out of my comfort zone to explore how to design an app logo for my newsletter app, without any prior design skills. Stay tuned!