2025 Developer ToolsApp Services
WWDC25 · 22 min · Developer Tools / App Services
Code-along: Explore localization with Xcode
Learn how to localize your app into additional languages using Xcode. We’ll walk step-by-step through the process of creating a String Catalog, translating text, and exchanging files with external translators. You’ll learn best practices for providing necessary context to translators and how Xcode can help to provide this information automatically. For larger projects, we’ll also dive into techniques to manage complexity and streamline string management using type-safe Swift code.
Watch at developer.apple.com ↗Chapters
Code shown on screen · 6 snippets
Localizable strings
// import SwiftUI
Text("Featured Landmark", comment: "Big headline in the hero image of featured landmarks.")
Button("Keep") { }
// import Foundation
String(localized: "New Collection", comment: "Default name for a new user-created collection.") Adding a comment
Text("Delete",
comment: "Delete button shown in an alert asking for confirmation to delete the collection.")
String(localized: "Shared by Friends", comment: "Subtitle of post that was shared by friends.") XLIFF file
// Field for automatically generated comments in the XLIFF
<trans-unit id="Grand Canyon" xml:space="preserve">
<source>Grand Canyon</source>
<target state="new">Grand Canyon</target>
<note from="auto-generated">Suggestion for searching landmarks</note>
</trans-unit> Localized String in the main app and a Swift Package or Framework
// Localized String in the main app:
Text("My Collections",
comment: "Section title above user-created collections.")
// Localized String in a Swift Package or Framework
Text("My Collections",
bundle: #bundle,
comment: "Section title above user-created collections.") Localized String with a tableName parameter
// Localized String in the main app:
Text("My Collections",
tableName: "Discover",
comment: "Section title above user-created collections.")
// Localized String in a Swift Package or Framework
Text("My Collections",
tableName: "Discover",
bundle: #bundle,
comment: "Section title above user-created collections.") Symbol usage
// Symbol usage in SwiftUI
Text(.introductionTitle)
.navigationSubtitle(.subtitle(friendsPosts: 42))
// Symbol usage in Foundation
String(localized: .curatedCollection)
// Working with generated symbols in your own types
struct CollectionDetailEditingView: View {
let title: LocalizedStringResource
init(title: LocalizedStringResource) {
self.title = title
}
}
CollectionDetailEditingView(title: .editingTitle) Resources
Related sessions
-
32 min