← Back to Skills Marketplace
soponcd

I18n Swift

by soponcd · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
127
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install i18n-swift
Description
Swift internationalization patterns, String(localized:) usage, and semantic key naming for macOS/iOS apps
README (SKILL.md)

Swift Internationalization

Expert-level Swift i18n patterns for macOS/iOS applications. Covers string localization, semantic key naming, and best practices.

When: to Use

Use this skill when:

  • Adding localized strings to SwiftUI views
  • Creating new localization keys
  • Writing String(localized:) calls
  • Organizing Localizable.strings files
  • Reviewing i18n implementation in Swift projects

Core Principles

1. String(localized:) Pattern

// Always use String(localized:) for user-facing text
Text(String(localized: "common.save"))
Button(String(localized: "sidebar.today"))

// Never hardcode strings
Text("Save")  // ❌ Wrong

2. Semantic Key Naming

Use domain.feature.key pattern:

// Good: Semantic keys
"app.name" = "TimeFlow"
"common.save" = "Save"
"sidebar.today" = "Today"
"settings.theme.title" = "Theme"

// Bad: Non-semantic keys
"saveButton" = "Save"
"viewTitle1" = "Today"
"themeTitle" = "Theme"

3. Localizable.strings Organization

Group by domain with MARK comments:

/*
 Localizable.strings
 TimeFlow
*/

// MARK: - App
"app.name" = "TimeFlow";

// MARK: - Common
"common.delete" = "Delete";
"common.save" = "Save";
"common.cancel" = "Cancel";

// MARK: - Sidebar
"sidebar.today" = "Today";
"sidebar.settings" = "Settings";
"sidebar.daily_note" = "Daily Note";

// MARK: - GTD Navigation
"gtd.inbox" = "Inbox";
"gtd.today" = "Today";
"gtd.projects" = "Projects";

Key Naming Conventions

Domain Feature Examples
app - app.name
common delete, save, cancel common.delete, common.save
sidebar today, settings, search sidebar.today, sidebar.settings
`home`` today, progress, timeline home.today, home.progress
gtd inbox, next, projects gtd.inbox, gtd.next
settings theme, language, sync settings.theme.title
sync idle, syncing, failed sync.idle, sync.syncing

SwiftUI Usage Patterns

Text Component

struct TodayView: View {
    var body: some View {
        VStack {
            Text(String(localized: "home.today"))
                .font(.title)

            Text(String(localized: "home.no_events"))
                .foregroundStyle(.secondary)
        }
    }
}

Button with Localized String

Button(String(localized: "common.save")) {
    // Save action
}
.disabled(isSaving)

Navigation Titles

NavigationLink(destination: SettingsView()) {
    Label(String(localized: "sidebar.settings"), systemImage: .gear)
}

Best Practices

Practice Reason
Use String(localized:) Prevents hardcoding, enables i18n
Semantic key names Self-documenting, easier maintenance
Group with // MARK: Organized, searchable strings files
Use domain.feature.key Clear ownership, prevents collisions
Update all languages together Prevents missing translations
Avoid format strings in keys Use Swift interpolation instead

String Interpolation

// Good: Use Swift interpolation
let message = String(localized: "sync.completed.count")
    .replacingOccurrences(of: "{count}", with: "\(count)")

// Alternative: Use String(format:) for localized format strings
let formatted = String(
    localized: "sync.completed.count",
    comment: "Number of items synced"
)

// Localizable.strings entry:
// "sync.completed.count" = "Synced %d items";

Common Pitfalls

Pitfall Consequence Prevention
Hardcoded strings Can't localize Always use String(localized:)
Non-semantic keys Difficult to maintain Use domain.feature.key pattern
Missing translations Shows key name Add entries to all .strings files
Format strings in keys Ambiguous values Use Swift interpolation
Duplicate keys Confusing maintenance Search before adding

Testing Patterns

func testLocalizationKeys() {
    // Verify all keys exist in Localizable.strings
    let keys = ["app.name", "common.save", "sidebar.today"]
    for key in keys {
        let localized = String(localized: key)
        XCTAssertNotEqual(localized, key, "Key not found: \(key)")
    }
}

Running Tests

# Test localization
xcodebuild test -scheme YourApp \
  -destination 'platform=macOS' \
  -only-testing:'YourAppTests/LocalizationTests/testKeysExist'
Usage Guidance
This skill is essentially a best-practices guide for Swift/iOS localization and appears coherent and low-risk. Before enabling it for autonomous use, consider: (1) the SKILL.md includes an example xcodebuild command — if you let the agent execute commands it could run tests in your workspace, so only allow execution when you trust the agent and working directory; (2) review any generated or suggested strings before applying them to your repo (pluralization/formatting choices may need manual review); and (3) the source is listed as a GitHub path — if provenance matters, inspect that repo to confirm the content. Otherwise this instruction-only skill does not request sensitive access and is internally consistent.
Capability Analysis
Type: OpenClaw Skill Name: i18n-swift Version: 1.0.0 The skill bundle provides standard documentation and best practices for Swift internationalization (i18n) in iOS/macOS development. All code snippets and instructions in SKILL.md are aligned with legitimate development patterns, and the included shell command for xcodebuild is a standard testing utility with no signs of malicious intent or data exfiltration.
Capability Assessment
Purpose & Capability
Name/description (Swift i18n, String(localized:), key naming) match the SKILL.md content. The skill requests no binaries, env vars, or config paths — appropriate for a documentation/instruction skill.
Instruction Scope
The SKILL.md contains coding patterns, examples, tests, and an example xcodebuild command; it does not instruct the agent to read unrelated files, exfiltrate data, or access credentials. The only runtime action shown (xcodebuild test) is directly relevant to testing localization and is presented as an example.
Install Mechanism
No install spec or code files are present; the skill is instruction-only so nothing is written to disk or downloaded during install.
Credentials
The skill declares no environment variables, secrets, or credentials. Nothing in the instructions requires access to external services or unrelated credentials.
Persistence & Privilege
always is false and the skill does not request elevated or persistent privileges. Autonomous invocation is allowed (platform default) but not combined with other privilege or credential requests.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install i18n-swift
  3. After installation, invoke the skill by name or use /i18n-swift
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of the i18n-swift skill. - Provides guidance on Swift internationalization for macOS/iOS apps, including String(localized:) usage. - Details semantic key naming conventions (domain.feature.key) and organization for Localizable.strings. - Offers best practices and common pitfalls for localized string management. - Includes sample SwiftUI usage patterns and testing strategies for localization keys.
Metadata
Slug i18n-swift
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is I18n Swift?

Swift internationalization patterns, String(localized:) usage, and semantic key naming for macOS/iOS apps. It is an AI Agent Skill for Claude Code / OpenClaw, with 127 downloads so far.

How do I install I18n Swift?

Run "/install i18n-swift" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is I18n Swift free?

Yes, I18n Swift is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does I18n Swift support?

I18n Swift is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created I18n Swift?

It is built and maintained by soponcd (@soponcd); the current version is v1.0.0.

💬 Comments