DEV Community

ArshTechPro
ArshTechPro

Posted on

Apple Killed Manual Localization: Xcode 26's AI Writes Comments & Generates Code For You

Xcode
The latest Xcode 26 release brings two revolutionary features that fundamentally transform how we approach iOS localization. As someone who's struggled with the traditional pain points of internationalization—forgotten comments, scattered string management, and repetitive boilerplate—these new capabilities feel like a glimpse into the future of development tooling.

AI-Generated Comments: Finally, Context That Actually Helps

The most impressive addition is automatic comment generation. An on-device model analyzes your code and writes contextual comments that translators actually need.

The Translation Context Problem

We've all been there. You write a string like this:

Text("Delete",
comment: "Delete button shown in an alert asking for confirmation to delete the collection.")
Enter fullscreen mode Exit fullscreen mode

But more often, we rush and write this:

Text("Delete") // TODO: Add comment for translators
Enter fullscreen mode Exit fullscreen mode

The TODO never gets done. Translators see "Delete" with zero context. Is it a verb? A noun? What's being deleted?

How the AI Actually Works

Right-click any string in your String Catalog and select "Generate Comment." The results are surprisingly sophisticated:

// Original string with no context
Button("Cancel") { }

// AI-generated comment:
// "The text label on a button to cancel the deletion of a collection"
Enter fullscreen mode Exit fullscreen mode

Another example:

Text("Location")
// AI generates: "A label displayed above the location of a landmark"
Enter fullscreen mode Exit fullscreen mode

The model doesn't just look at the string—it analyzes the surrounding code context, UI hierarchy, and usage patterns.

Making It Automatic

Enable this in Settings → Editing → "Automatically generate string catalog comments" and every new localizable string gets intelligent comments during builds. No more forgotten context.

The exported XLIFF files mark these as auto-generated:

<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>
Enter fullscreen mode Exit fullscreen mode

Translation services know exactly which comments came from AI versus human input.

Generated Symbols: Type-Safe String Management Revolution

The second game-changer is generated symbols for manually added strings. This introduces a workflow that separates string keys from their values—something many of us have built custom solutions for.

The Traditional Pain

We've all written code like this:

Text("Discover Landmarks")
.navigationSubtitle("42 from friends, 12 curated")
Enter fullscreen mode Exit fullscreen mode

Then product wants to change "Discover Landmarks" to "Explore Places." Now you're searching through code files, hoping you don't miss any instances.

The New Way

Add strings manually to your String Catalog with semantic keys:

String Catalog Entry:

  • Key: TITLE
  • Value: "Discover Landmarks"
  • Comment: "Navigation title for the discover screen"

Now your code becomes:

Text(.title)
Enter fullscreen mode Exit fullscreen mode

When product wants that copy change, you update it once in the String Catalog. Zero code changes.

Handling Dynamic Content

The really clever part is how placeholders work. In your catalog:

String Catalog Entry:

  • Key: SUBTITLE
  • Value: "%{friendsPosts}lld from friends, %{curatedPosts}lld curated"

This generates a function with named parameters:

.navigationSubtitle(.subtitle(friendsPosts: 42, curatedPosts: 12))
Enter fullscreen mode Exit fullscreen mode

The compiler enforces the correct types. No more runtime crashes from mismatched format specifiers.

Symbol Organization

For the default "Localizable" table:

Text(.introductionTitle)
String(localized: .curatedCollection)
Enter fullscreen mode Exit fullscreen mode

For custom tables like "Discover.xcstrings":

Text(.Discover.title)
.navigationSubtitle(.Discover.subtitle(friendsPosts: 42))
Enter fullscreen mode Exit fullscreen mode

The namespace prevents naming collisions between different feature areas.

Universal LocalizedStringResource Integration

Generated symbols work anywhere LocalizedStringResource is accepted, making them incredibly versatile:

// SwiftUI views
Text(.introductionTitle)

// Foundation strings
String(localized: .curatedCollection)

// Custom view types
struct CollectionDetailEditingView: View {
    let title: LocalizedStringResource

    init(title: LocalizedStringResource) {
        self.title = title
    }
}

CollectionDetailEditingView(title: .editingTitle)
Enter fullscreen mode Exit fullscreen mode

This means your custom components can accept localized strings without any additional boilerplate.

Seamless Workflow Transitions

The refactoring capabilities bridge both approaches beautifully. Select any string in your code and choose Refactor → Convert Strings to Symbols:

// Before refactoring
Text("42 new posts")

// After refactoring
Text(.feedTitle(newPosts: 42))
Enter fullscreen mode Exit fullscreen mode

You can batch-convert entire tables, customizing symbol names in a preview interface before applying changes.

Enhanced Project Organization

The new #bundle macro solves a major pain point for framework developers:

// Old way - brittle and error-prone
Text("My Collections", bundle: Bundle.module)

// New way - automatic and reliable
Text("My Collections", bundle: #bundle)
Enter fullscreen mode Exit fullscreen mode

The macro automatically resolves to the correct bundle for your current target, whether it's the main app, a framework, or a Swift package.

For organizing strings by feature, custom tables provide clean separation:

// Automatically uses Discover.xcstrings
Text("My Collections", tableName: "Discover", bundle: #bundle)
Enter fullscreen mode Exit fullscreen mode

Choosing Your Approach

Both workflows have their place:

String Extraction works great for:

  • Rapid prototyping
  • Small to medium projects
  • When you want strings visible in code
  • Getting started with localization

Generated Symbols excel for:

  • Large, complex projects
  • Teams with dedicated copywriters
  • Frequent copy iterations
  • Maximum type safety and organization

The beauty is you can mix approaches within the same project, using refactoring tools to evolve your strategy as needs change.

Best Practices

For AI Comments:

  • Enable automatic generation—it's surprisingly good
  • Review and enhance generated comments when domain-specific context helps
  • Your manual comments always override generated ones

For Symbol Generation:

  • Use semantic, uppercase keys: DISCOVER_TITLE, DELETE_CONFIRMATION
  • Enable the "Generate String Catalog Symbols" build setting
  • Organize related strings into dedicated tables

For Project Organization:

  • Start with extraction, refactor to symbols as complexity grows
  • Use custom tables to group feature-specific strings
  • Leverage the #bundle macro for framework development

The Bigger Picture

These features represent more than incremental improvements—they're fundamental advances in developer tooling. The AI-powered comment generation eliminates a major barrier to quality localization, while generated symbols provide the type safety and organization that large projects desperately need.

For the first time, professional-grade localization feels approachable for every iOS developer, not just teams with dedicated internationalization specialists. The combination of intelligent automation and developer-friendly APIs creates a workflow that scales from indie apps to enterprise software.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.