---
title: "How do I localize text in SwiftUI?"
description: "Pass string literals to `Text`, `Button`, `Label` and similar views; they are `LocalizedStringKey` values that SwiftUI looks up in the String Catalog automatically. A `String` variable is shown as is unless you wrap it in `LocalizedStringKey`, and `Text(verbatim:)` opts out of localization."
category: ios
date: 2026-10-09
canonical: https://localizely.com/i18n-questions/ios/how-do-i-localize-text-in-swiftui/
---

# How do I localize text in SwiftUI?

SwiftUI localizes string literals for you. `Text("Welcome")` does not take a `String`; the literal becomes a `LocalizedStringKey`, and the view looks that key up in `Localizable.xcstrings` (or `Localizable.strings`) for the language the app runs in. If no translation exists, the key itself is shown, which is why an app without translations still looks right.

The same applies to the title parameters of `Button("Save")`, `Label("Message", systemImage: "envelope")`, `TextField("Email", text: $email)`, `Toggle`, `Picker` and `.navigationTitle("Settings")`. Add a String Catalog to the project (File > New > File from Template, then String Catalog) and build: Xcode extracts every literal into it, and each later build keeps the catalog in sync with the code.

Variables are the main pitfall. A `String` value is not localized, because SwiftUI assumes it is user content:

```swift
Text(item.name)                     // shown as is
Text(LocalizedStringKey(item.key))  // looked up as a key
```

Use the second form only for keys you control; nothing is extracted for it at build time, so the entries must already exist in the catalog.

Put dynamic values into the literal with interpolation. `Text("Hello, \(name)")` looks up the key `Hello, %@` and inserts the value, and `Text("\(count) items")` produces `%lld items`, which you can turn into a plural rule in the catalog. Do not concatenate pieces with `+`; translators need the whole sentence.

For text that must never be translated, such as a brand name or a code, use `Text(verbatim: "Localizely")`.

When a string travels through your own types, declare the property as `LocalizedStringResource` rather than `String`. It can still be initialized with a literal, `Text` accepts it, and the string stays localizable.

Add a comment where the literal alone is ambiguous: `Text("Book", comment: "Verb: reserve a table")`. Xcode exports it to translators together with the string.

To see another language in a preview, set the locale environment of the view: `ContentView().environment(\.locale, Locale(identifier: "de"))`. To run the whole app in a language, use Product > Scheme > Edit Scheme > Run > Options > App Language. For strings created outside views, `String(localized: "Welcome")` (iOS 15 and later) reads the same catalog.

Source: https://localizely.com/i18n-questions/ios/how-do-i-localize-text-in-swiftui/
