Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    AI reads brain MRIs in seconds and flags emergencies

    February 11, 2026

    In vivo tracking of CAR-T cells in tumors via nanobubble-based contrast enhanced ultrasound

    February 11, 2026

    Exposed Training Open the Door for Crypto-Mining in Fortune 500 Cloud Environments

    February 11, 2026
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»Working with String Catalogs for App Localization in iOS 17
    iOS Development

    Working with String Catalogs for App Localization in iOS 17

    big tee tech hubBy big tee tech hubJune 6, 2025005 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    Working with String Catalogs for App Localization in iOS 17
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    With the release of Xcode 15, Apple introduced an exciting feature called String Catalogs. This feature aims to streamline the localization process for your app, making it easier to manage all your strings in one central location. By leveraging String Catalogs, you can ensure that your app is fully localized before it reaches your users. This new feature offers both convenience and confidence in the localization process.

    In earlier versions of Xcode, you have to go through a string internationalization process that requires to modify the existing texts with the String(localized:) macro before localization. However, with the introduction of String Catalogs, this process is no longer necessary. For SwiftUI projects, String Catalogs automatically extracts all user-facing texts for you, eliminating the need for manual modifications.

    Let’s create a simple project and see how String Catalogs can simplify the localization process for your SwiftUI app projects.

    Building a Simple Demo for Localization

    Assuming you’ve installed Xcode 15, create a new SwiftUI project and replace the code in ContentView like this:

    struct ContentView: View {
        var body: some View {
            VStack {
                Text("ProLingo")
                    .font(.system(size: 75, weight: .black, design: .rounded))
    
                Text("Learn programming languages by working on real projects")
                    .font(.headline)
                    .padding(.horizontal)
    
                Spacer()
    
                Image(systemName: "macbook.and.iphone")
                    .font(.system(size: 200))
    
                Spacer()
    
                Button(action: {}) {
                    Text("Get Started for free")
                        .font(.headline)
                        .frame(maxWidth: .infinity)
                }
                .tint(.indigo)
                .controlSize(.large)
                .buttonStyle(.borderedProminent)
    
                Button(action: {}) {
                    Text("I already have an account")
                        .font(.headline)
                        .frame(maxWidth: .infinity)
                }
                .tint(.black)
                .controlSize(.large)
                .buttonStyle(.borderedProminent)
    
            }
            .padding()
        }
    }

    It’s a very simple login screen for demo purpose. If you’ve written the code above, Xcode should show you the sample login screen in the preview pane.

    swiftui-string-catalogs-demo-project

    Using String Catalogs

    By default, Xcode projects are configured to support only the English language. If you want to add support for an additional language, first select the project file in the project navigator. Then go to the Info tab and locate the Localizations section. Click the “+” button to add a new language. Next, choose your desired language, such as traditional Chinese, from the available options.

    xcode-add-new-language

    Once you’ve completed these steps, your Xcode project will have support for the selected language, allowing for localization.

    The String Catalog file is not bundled in the Xcode project. Before localization, you have to manually create a String Catalog file. In the project navigator, right-click the project folder and select “New File…”. Under the iOS category, look for the String Catalog template. Click Next to proceed and then name the file Localizable.

    add-string-catalog-template

    This process generates an empty Localizable file that includes all the supported languages for your app. To extract all the user-facing texts into this file, you can follow these steps: select Product from the Xcode menu and choose Build to rebuild the project. After the build process, Xcode will automatically extract all the text and populate them in the Localizable file.

    swiftui-localizable-file

    Once the texts are extracted, you can proceed to add translations directly in the String Catalog file for each language. This allows you to provide localized versions of the text and ensure the app is properly localized for different languages.

    When you add new user-facing text in your project, Xcode will automatically include them in the String Catalog. This process occurs every time you build the project. It ensures that the newly added text is properly managed and can be easily localized for different languages.

    Testing the Localized App

    There are a couple of ways to test the localization of your app. One approach is to change the language preference of the simulator and then run the localized app on it, allowing you to see how the app behaves in different languages. Another option is to utilize a preview feature in Xcode that enables you to test your app in various languages and regions, both at runtime and in Interface Builder. Let’s explore these options in detail.

    To enable the preview at runtime feature in Xcode, you can modify the scheme sheet. Within the scheme settings, you can set your preferred language in the dialog box, allowing you to preview how the app appears and functions in that specific language.

    swiftui-edit-scheme

    In the dialog box, select Run > Options and change the App language to your preferred language. For example, Chinese (Traditional). Click the Close button to save the setting.

    Xcode-simulator-change-language

    Now click the Run button to launch the app; the language of the simulator should set to your preferred language. If you’ve set it to Chinese/German, your app should look like the screenshot.

    swiftui-app-in-chinese

    Testing the Localization Using Preview

    To preview the localization of a SwiftUI app, you can utilize the locale environment variable in your preview code. This allows you to simulate the app UI in different languages. For example, if you wish to preview the app UI in Traditional Chinese, you can add an additional preview code block with the desired locale settings. Here’s an example:

    #Preview("Traditional Chinese") {
        ContentView()
            .environment(\.locale, .init(identifier: "zh-Hant"))
    }

    By setting the locale environment variable to .init(identifier: "zh-Hant"), you can preview the app UI with Traditional Chinese. You can modify the identifier to simulate other languages as needed.

    Adding Comment to Your Text

    In the Localizable file, there is a comment field that displays the associated comment for each key and translation. If you wish to add comments for a specific key, you can include them when defining the Text view, like this:

    Text("I already have an account", comment: "Login button")

    Once you modify the code with the comment, it’ll appear in the Localizable file.

    swiftui-add-comment

    Summary

    In this tutorial, I have guided you through the localization process in Xcode. The introduction of String Catalogs in Xcode 15 has significantly simplified the workflow for developers. This new feature automates the extraction of text from SwiftUI views and consolidates them into a centralized file. Furthermore, translators can conveniently edit the translations directly within Xcode, streamlining the localization process.

    Note: This is a sample chapter (modified version) of the Mastering SwiftUI book.



    Source link

    app Catalogs iOS Localization String working
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    iOS 26, using Swift, how can I group multiple Liquid Glass buttons into a single pill view?

    February 11, 2026

    The importance of human touch in AI-driven development – Donny Wals

    February 10, 2026

    ios – Get notification history paginationToken and startTime inconsistency

    February 9, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    AI reads brain MRIs in seconds and flags emergencies

    February 11, 2026

    In vivo tracking of CAR-T cells in tumors via nanobubble-based contrast enhanced ultrasound

    February 11, 2026

    Exposed Training Open the Door for Crypto-Mining in Fortune 500 Cloud Environments

    February 11, 2026

    9 Best Cheap Laptops (2026), Tested and Reviewed

    February 11, 2026
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    AI reads brain MRIs in seconds and flags emergencies

    February 11, 2026

    In vivo tracking of CAR-T cells in tumors via nanobubble-based contrast enhanced ultrasound

    February 11, 2026

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2026 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.