app-localization
Skill39 starsChanged 11 months agoApache-2.0View on GitHub
iOS/macOS app localization management for Tuist-based projects with .strings files. Use when: (1) Adding new translation keys to modules, (2) Validating .strings files for missing/duplicate keys, (3) Syncing translations across languages, (4) AI-powered translation from English to other locales, (5) Checking placeholder consistency (%@, %d), (6) Generating localization reports, (7) Updating Swift code to use localized strings instead of hardcoded text.
In this repository7 other files it gives its agents.
- appstore-info-generatorSkill
- domain-designSkill
- feature-lifecycleSkill
- ios-app-scaffoldSkill
- ios-ux-prototypeSkill
- swiftui-atomic-designSkill
- template-skillSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 30
After editing .strings files, run tuist generate to regenerate type-safe accessors.
- Distinctive: line 47
Add keys to all language files:
- Distinctive: line 144
Run validation script to check consistency:
- Distinctive: line 151
When translating strings to non-English locales:
- Distinctive: line 153
Read the English source string
- Very specific: line 154
Consider context from the key name (e.g., search.noResults = search UI)
- Distinctive: line 191
Add missing keys as placeholders:
- Distinctive: line 262
Use positional parameters (%1$@, %2$d) when order differs between languages
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
App Localization
Manage iOS/macOS .strings files in Tuist-based projects.
Project Structure
<ModuleName>/
├── Resources/
│ ├── en.lproj/Localizable.strings # Primary language (English)
│ ├── <locale>.lproj/Localizable.strings # Additional locales
│ └── ...
├── Derived/
│ └── Sources/
│ └── TuistStrings+<ModuleName>.swift # Generated by Tuist
└── Sources/
└── **/*.swift # Uses <ModuleName>Strings.Section.keyAfter editing .strings files, run tuist generate to regenerate type-safe accessors.
Complete Localization Workflow
Step 1: Identify Hardcoded Strings
Find hardcoded strings in Swift files:
# Find Text("...") patterns with hardcoded strings
grep -rn 'Text("[A-Z]' <ModuleName>/Sources/
grep -rn 'title: "[A-Z]' <ModuleName>/Sources/
grep -rn 'label: "[A-Z]' <ModuleName>/Sources/
grep -rn 'placeholder: "[A-Z]' <ModuleName>/Sources/Step 2: Add Translation Keys
Add keys to all language files:
en.lproj/Localizable.strings (primary):
/* Section description */
"section.key.name" = "English value";
"section.key.withParam" = "Value with %@";Other locales (translate appropriately):
"section.key.name" = "<translated value>";
"section.key.withParam" = "<translated> %@";Step 3: Generate Type-Safe Accessors
tuist generateThis creates Derived/Sources/TuistStrings+<ModuleName>.swift with accessors:
<ModuleName>Strings.Section.keyName(static property)<ModuleName>Strings.Section.keyWithParam(value)(static function for %@ params)
See references/tuist-strings-patterns.md for detailed patterns.
Step 4: Update Swift Code
Replace hardcoded strings with generated accessors.
Pattern Mapping
| Hardcoded Pattern | Localized Pattern |
Text("Title") | Text(<Module>Strings.Section.title) |
Text("Hello, \(name)") | Text(<Module>Strings.Section.hello(name)) |
title: "Submit" | title: <Module>Strings.Action.submit |
placeholder: "Enter..." | placeholder: <Module>Strings.Field.placeholder |
Example Transformations
Before:
Text("Settings")
.font(.headline)
TextField("Enter your name", text: $name)
Button("Submit") { ... }
Text("Hello, \(userName)!")After:
Text(<Module>Strings.Section.settings)
.font(.headline)
TextField(<Module>Strings.Field.namePlaceholder, text: $name)
Button(<Module>Strings.Action.submit) { ... }
Text(<Module>Strings.Greeting.hello(userName))Handling Parameters and Plurals
String with parameter (key: "search.noResults" = "No results for \"%@\""):
// Before
Text("No results for \"\(searchText)\"")
// After
Text(<Module>Strings.Search.noResults(searchText))Conditional plurals:
// Keys:
// "item.count" = "%d item"
// "item.countPlural" = "%d items"
// Swift:
let label = count == 1
? <Module>Strings.Item.count(count)
: <Module>Strings.Item.countPlural(count)Multiple parameters (key: "message.detail" = "%@ uploaded %d files"):
Text(<Module>Strings.Message.detail(userName, fileCount))Step 5: Validate Changes
- Build the project to catch missing keys
- Run validation script to check consistency:
python scripts/validate_strings.py /path/to/<ModuleName>AI-Powered Translation
When translating strings to non-English locales:
- Read the English source string
- Consider context from the key name (e.g.,
search.noResults= search UI) - Translate appropriately for the target locale:
- zh-Hans: Simplified Chinese, formal but friendly
- zh-Hant: Traditional Chinese
- ja: Japanese, polite form (desu/masu style)
- ko: Korean, polite form (hamnida/yo style)
- de/fr/es/etc.: Appropriate regional conventions
- Preserve all placeholders exactly (%@, %d, %ld, etc.)
Translation context by UI element:
- Labels: Keep concise
- Buttons: Action-oriented verbs
- Placeholders: Instructive tone
- Error messages: Helpful and clear
- Confirmations: Clear consequences
Validation Scripts
Validate .strings Files
python scripts/validate_strings.py /path/to/<ModuleName>Checks for:
- Missing keys between languages
- Duplicate keys
- Placeholder mismatches (%@, %d, %ld)
- Untranslated strings (value = English)
Sync Missing Translations
Report missing keys:
python scripts/sync_translations.py /path/to/<ModuleName> --reportAdd missing keys as placeholders:
python scripts/sync_translations.py /path/to/<ModuleName> --syncKey Naming Convention
Pattern: "domain.context.element" → <Module>Strings.Domain.Context.element
Domain-Focused Naming (User Mental Model)
Keys should reflect what the user is doing, not technical UI components:
| User Mental Model | Key Pattern | Generated Accessor |
| "I'm looking at my profile" | "profile.name" | Strings.Profile.name |
| "I'm testing a build" | "betaBuild.whatToTest" | Strings.BetaBuild.whatToTest |
| "I'm adding a tester" | "testerGroup.addTester" | Strings.TesterGroup.addTester |
| "Something went wrong with sync" | "sync.error.failed" | Strings.Sync.Error.failed |
Good vs Bad Examples
| Bad (Technical) | Good (Domain-Focused) |
button.save | profile.save |
field.email | registration.email |
placeholder.search | appSelector.searchPlaceholder |
error.network | sync.connectionFailed |
label.title | settings.title |
alert.confirm | build.expireConfirm |
Structure by Feature/Screen
Organize keys by the feature or screen where they appear:
/* Profile Section */
"profile.title" = "Profile";
"profile.name" = "Name";
"profile.save" = "Save Changes";
"profile.saveSuccess" = "Profile updated";
/* Beta Builds */
"betaBuild.title" = "Beta Builds";
"betaBuild.whatToTest" = "What to Test";
"betaBuild.submitForReview" = "Submit for Review";
"betaBuild.expireConfirm" = "Expire this build?";
/* Tester Groups */
"testerGroup.create" = "Create Group";
"testerGroup.addTester" = "Add Tester";
"testerGroup.empty" = "No testers yet";This mirrors how users think: "I'm in Beta Builds, submitting for review" → betaBuild.submitForReview
.strings File Format
/* Comment describing the section */
"key.name" = "Value";
"key.with.parameter" = "Hello, %@!";
"key.with.number" = "%d items";
"key.with.multiple" = "%1$@ has %2$d items";Rules:
- Keys must be unique within a file
- Values are UTF-8 encoded
- Escape quotes with backslash:
\" - Line ends with semicolon
- Use positional parameters (%1$@, %2$d) when order differs between languages
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

