skills/generators/localization-setup/SKILL.md
Generate internationalization (i18n) infrastructure for multi-language support in iOS/macOS apps. Use when localizing for multiple languages, adopting String Catalogs (xcstrings), or supporting RTL languages.
npx skillsauth add rshankras/claude-code-apple-skills localization-setupInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate internationalization (i18n) infrastructure for multi-language support in iOS/macOS apps.
Before generating, verify:
Existing Localization
# 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
Deployment Target
# String Catalogs require iOS 16+ / macOS 13+
grep -r "IPHONEOS_DEPLOYMENT_TARGET\|MACOSX_DEPLOYMENT_TARGET" *.xcodeproj 2>/dev/null
Project Structure
# Find project for adding localization
find . -name "*.xcodeproj" | head -1
Resources/
└── Localizable.xcstrings # String catalog with all translations
Sources/Localization/
├── LocalizedStrings.swift # Type-safe string access
├── LocalizationManager.swift # Runtime language switching
└── LocalizedPreview.swift # SwiftUI preview helpers
// 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)
// 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"))
// In String Catalog:
// key: "greeting"
// value: "Hello, %@!"
let name = "Alice"
Text(String(localized: "greeting \(name)"))
// Preview in different locale
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environment(\.locale, Locale(identifier: "es"))
}
}
If migrating from .strings files:
// 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)
label.text = String(localized: "hello_world")
// or
label.text = NSLocalizedString("hello_world", comment: "Greeting")
// Good: Descriptive, hierarchical
"settings.appearance.theme"
"onboarding.step1.title"
"error.network.connection_failed"
// Avoid: Vague or hardcoded text as key
"button1"
"Hello, World!"
String(localized: "delete_confirmation",
comment: "Alert message asking user to confirm deletion")
// 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))
// Automatic with SwiftUI
// For manual layout adjustments:
.environment(\.layoutDirection, .rightToLeft)
#Preview {
ContentView()
.environment(\.locale, Locale(identifier: "ja"))
}
development
Build, install, and launch an iOS app on a physical iPhone or iPad entirely from the command line (no Xcode GUI), using xcodebuild + devicectl. Use when the user wants to run, test, or screenshot their app on a real device without opening Xcode.
development
Comprehensive iOS development guidance including Swift best practices, SwiftUI patterns, UI/UX review against HIG, and app planning. Use for iOS code review, best practices, accessibility audits, or planning new iOS apps.
development
Build, install, launch, and screenshot an iOS app in the Simulator to verify a change visually. Use when the user wants to run the app, see a change live, screenshot the running app, or confirm a UI fix actually works (not just that it compiles).
development
Audits skills in this repo for consistency, API drift, and structural gaps. Produces a prioritized report grouped by severity (Critical/High/Medium/Low). Use when asked to "audit skills", "check the skill repo for drift", or when planning bulk skill cleanup. Read-only — does not apply fixes.