Localization Setup Generator

Generate internationalization (i18n) infrastructure for multi-language support in iOS/macOS apps.

110 stars

Best use case

Localization Setup Generator is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generate internationalization (i18n) infrastructure for multi-language support in iOS/macOS apps.

Teams using Localization Setup Generator should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/localization-setup/SKILL.md --create-dirs "https://raw.githubusercontent.com/gustavscirulis/snapgrid/main/.claude/skills/skills/generators/localization-setup/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/localization-setup/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Localization Setup Generator Compares

Feature / AgentLocalization Setup GeneratorStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generate internationalization (i18n) infrastructure for multi-language support in iOS/macOS apps.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Localization Setup Generator

Generate internationalization (i18n) infrastructure for multi-language support in iOS/macOS apps.

## When to Use

- User wants to localize their app for multiple languages
- User mentions i18n, internationalization, or localization
- User asks about String Catalogs or .strings files
- User wants to support RTL (right-to-left) languages

## Pre-Generation Checks

Before generating, verify:

1. **Existing Localization**
   ```bash
   # Check for existing localization files
   find . -name "*.xcstrings" -o -name "Localizable.strings" 2>/dev/null | head -5
   find . -name "*.lproj" -type d 2>/dev/null | head -5
   ```

2. **Deployment Target**
   ```bash
   # String Catalogs require iOS 16+ / macOS 13+
   grep -r "IPHONEOS_DEPLOYMENT_TARGET\|MACOSX_DEPLOYMENT_TARGET" *.xcodeproj 2>/dev/null
   ```

3. **Project Structure**
   ```bash
   # Find project for adding localization
   find . -name "*.xcodeproj" | head -1
   ```

## Configuration Questions

### 1. Localization Approach
- **String Catalogs** (Recommended, iOS 16+) - Modern, visual editor in Xcode
- **Legacy .strings** - Traditional approach, all iOS versions

### 2. Initial Languages
- English (en) - default
- Which additional languages? (e.g., es, de, fr, ja, zh-Hans)

### 3. Features
- **Pluralization** - Handle "1 item" vs "2 items"
- **Device-specific** - Different strings for iPhone/iPad/Mac
- **SwiftUI Preview** - Preview in different locales

## Generated Files

### String Catalogs (Recommended)
```
Resources/
└── Localizable.xcstrings    # String catalog with all translations
```

### Supporting Code
```
Sources/Localization/
├── LocalizedStrings.swift   # Type-safe string access
├── LocalizationManager.swift # Runtime language switching
└── LocalizedPreview.swift   # SwiftUI preview helpers
```

## Key Features

### Type-Safe String Access

```swift
// Generated enum for type-safe access
enum L10n {
    static let appName = String(localized: "app_name")
    static let welcomeMessage = String(localized: "welcome_message")

    enum Settings {
        static let title = String(localized: "settings_title")
        static let language = String(localized: "settings_language")
    }
}

// Usage
Text(L10n.appName)
Text(L10n.Settings.title)
```

### Pluralization

```swift
// In String Catalog, define plural rules
// key: "items_count"
// variations:
//   - zero: "No items"
//   - one: "1 item"
//   - other: "%lld items"

Text(String(localized: "items_count \(count)",
            defaultValue: "\(count) items"))
```

### String Interpolation

```swift
// In String Catalog:
// key: "greeting"
// value: "Hello, %@!"

let name = "Alice"
Text(String(localized: "greeting \(name)"))
```

### Runtime Language Switching

```swift
// Preview in different locale
struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
            .environment(\.locale, Locale(identifier: "es"))
    }
}
```

## Integration Steps

### 1. Add String Catalog

1. In Xcode: File > New > File
2. Choose "String Catalog"
3. Name it "Localizable.xcstrings"
4. Add to your app target

### 2. Add Supported Languages

1. Select project in navigator
2. Info tab > Localizations
3. Click + to add languages

### 3. Migrate Existing Strings

If migrating from .strings files:
1. Right-click .strings file
2. "Migrate to String Catalog..."

### 4. Use in SwiftUI

```swift
// Automatic localization
Text("Hello, World!")  // Uses String Catalog automatically

// Explicit localized string
Text(String(localized: "custom_key"))

// With type-safe enum (generated)
Text(L10n.welcomeMessage)
```

### 5. Use in UIKit

```swift
label.text = String(localized: "hello_world")
// or
label.text = NSLocalizedString("hello_world", comment: "Greeting")
```

## Best Practices

### Key Naming Conventions
```
// Good: Descriptive, hierarchical
"settings.appearance.theme"
"onboarding.step1.title"
"error.network.connection_failed"

// Avoid: Vague or hardcoded text as key
"button1"
"Hello, World!"
```

### Comments for Translators
```swift
String(localized: "delete_confirmation",
       comment: "Alert message asking user to confirm deletion")
```

### Formatting
```swift
// Numbers - Use FormatStyle
Text(price, format: .currency(code: "USD"))

// Dates - Use FormatStyle
Text(date, format: .dateTime.month().day())

// Lists - Use ListFormatStyle
Text(items, format: .list(type: .and))
```

### RTL Support
```swift
// Automatic with SwiftUI
// For manual layout adjustments:
.environment(\.layoutDirection, .rightToLeft)
```

## Testing Localization

### In Xcode
1. Edit Scheme > Run > Options
2. Set "App Language" to test language
3. Set "App Region" for number/date formatting

### In SwiftUI Previews
```swift
#Preview {
    ContentView()
        .environment(\.locale, Locale(identifier: "ja"))
}
```

### Export for Translation
1. Product > Export Localizations...
2. Share .xliff files with translators
3. Import translated .xliff files

## References

- [String Catalogs](https://developer.apple.com/documentation/xcode/localizing-and-varying-text-with-a-string-catalog)
- [Localization Guide](https://developer.apple.com/localization/)
- [Formatting Numbers and Dates](https://developer.apple.com/documentation/foundation/formatstyle)

Related Skills

snapshot-test-setup

110
from gustavscirulis/snapgrid

Set up SwiftUI visual regression testing with swift-snapshot-testing. Generates snapshot test boilerplate and CI configuration. Use for UI regression prevention.

characterization-test-generator

110
from gustavscirulis/snapgrid

Generates tests that capture current behavior of existing code before refactoring. Use when you need a safety net before AI-assisted refactoring or modifying legacy code.

prd-generator

110
from gustavscirulis/snapgrid

Generates comprehensive Product Requirements Document from product plan. Creates PRD.md with features, user stories, acceptance criteria, and success metrics. Use when creating product requirements.

localization-strategy

110
from gustavscirulis/snapgrid

Localization and internationalization strategy for iOS/macOS apps. Covers market prioritization, language tier recommendations, minimum viable localization levels, translation workflows, cultural adaptation, localized ASO, and testing. Use when planning localization, expanding to new markets, deciding which languages to support, or planning translation workflow.

idea-generator

110
from gustavscirulis/snapgrid

Brainstorm and rank iOS/macOS app ideas tailored to developer skills. Use when user says "what should I build", "give me app ideas", "I don't know what to build", "brainstorm app ideas", or "help me find an app idea".

widget-generator

110
from gustavscirulis/snapgrid

Generate WidgetKit widgets for iOS/macOS home screen and lock screen with timeline providers, interactive elements, and App Intent configuration. Use when adding widgets to an app.

tipkit-generator

110
from gustavscirulis/snapgrid

Generate TipKit infrastructure with inline/popover tips, rules, display frequency, and testing utilities. Use when adding contextual tips or feature discovery to an iOS/macOS app.

test-generator

110
from gustavscirulis/snapgrid

Generate test templates for unit tests, integration tests, and UI tests using Swift Testing and XCTest. Use when adding tests to iOS/macOS apps.

Push Notifications Generator

110
from gustavscirulis/snapgrid

Generate push notification infrastructure with APNs registration, handling, and rich notifications.

persistence-setup

110
from gustavscirulis/snapgrid

Generates SwiftData or CoreData persistence layer with optional iCloud sync. Use when user wants to add local storage, data persistence, or cloud sync.

paywall-generator

110
from gustavscirulis/snapgrid

Generates StoreKit 2 subscription paywall with modern SwiftUI views. Use when user wants to add subscriptions, paywall, or in-app purchases.

onboarding-generator

110
from gustavscirulis/snapgrid

Generates multi-step onboarding flows with persistence for iOS/macOS apps. Use when user wants to add onboarding, welcome screens, or first-launch experience.