Translating Your App
This guide covers the complete workflow for translating your app with XCStrings Translator.
Opening Your Project#
- Launch XCStrings Translator
- Click Open Project and select your Xcode project folder
- Your
.xcstringsfiles appear in the left sidebar
The app scans up to 3 levels deep for String Catalog files.
Translating Strings#
Translate Selected:
- Click on strings to select them (Cmd + click for multiple)
- Press
Cmd + Tor click the Translate button
Translate All Untranslated:
- Press
Cmd + Shift + T - All strings with "new" state are processed
Adding Languages in Xcode#
To add a new language to your app:
- Open your project in Xcode
- Select your project in the navigator
- Select the project (not a target)
- Go to the Info tab
- Under Localizations, click +
- Choose a language from the list
Xcode adds the language to all String Catalogs with "state": "new" for each string. Then open your project in XCStrings Translator to translate them.
For more information, see Apple's documentation on localizing your app.
Adding Context with Comments#
Good translations need context. Add comments in your Swift code:
// SwiftUI
Text("Post", comment: "Button to publish a new blog entry")
// String(localized:)
String(localized: "Post", comment: "Noun: A blog post, not the verb")Without the comment, the AI might translate "Post" as a fence post instead of a blog post.
Writing Effective Comments#
Do:
- Explain what the UI element is (button, title, error message)
- Clarify ambiguous words
- Mention character limits if relevant
- Note if something shouldn't be translated
Text("Save", comment: "Button to save document changes")
Text("iPhone", comment: "Product name, do not translate")Don't:
- Repeat the string value:
comment: "Save" - Add implementation details:
comment: "Calls saveDocument()"
How Xcode Extracts Strings#
When you build your project, Xcode:
- Extracts strings from
Text(),String(localized:), and other APIs - Adds new keys with state
"new" - Marks strings as
"stale"if the source text changes - Preserves existing translations
Enable "Use Compiler to Extract Swift Strings" in your target's build settings for the most accurate extraction.
Review and Save#
After translation:
- Double-click any string to edit manually
- Review translations marked as "needs_review"
- Press
Cmd + Sto save
Changes are written directly to your .xcstrings file, so you can commit them with git.
Keyboard Shortcuts#
| Shortcut | Action |
|---|---|
Cmd + T | Translate selected strings |
Cmd + Shift + T | Translate all untranslated |
Next Steps#
- Learn about plural rules for handling "1 item" vs "5 items"
- Set up custom prompts for better translation quality
- Understand translation states to manage your workflow