How do I use Text concatenations now to use localizable ids?

Asked on 06/14/2025

1 search

To use text concatenations with localizable IDs in Xcode, you can leverage the new feature of generating symbols for localized strings. This feature allows you to access your localized strings using generated Swift symbols, which can be directly accessed if you use the default table name "localizable." If you use a non-default table name, the generated symbols are nested within the namespace of that table.

Here's a brief overview of how you can use this feature:

  1. String Catalogs: Add a string catalog to your project. Xcode will automatically discover localizable strings after each build and add them to the catalog.

  2. Generated Symbols: When you use the default table name "localizable," your symbols are directly accessible. For non-default table names, symbols are nested in the namespace of that table.

  3. Type-Safe API: You can reference these strings using a type-safe API, which helps in maintaining and understanding your code better.

  4. Symbol Generation: New projects created by Xcode have symbol generation enabled by default. For existing projects, you need to enable the build setting "Generate String Catalog Symbols."

  5. Using in Code: You can use these generated symbols in SwiftUI views like Text or Button, or in view modifiers like NavigationSubtitle.

For more detailed guidance, you can refer to the session Code-along: Explore localization with Xcode (17:50) where these features are discussed in depth.