Skip to content

Commit b45347c

Browse files
vrcprlclaude
andauthored
feat: add an xcode-xcstrings-v2 bucket that supports CLDR pluralization rules (#1230)
* feat: add xcode-xcstrings-v2 bucket with ICU MessageFormat support Add opt-in xcode-xcstrings-v2 bucket type that converts CLDR plural forms to ICU MessageFormat for better translation quality and variable handling. ## Key Features - **ICU MessageFormat conversion**: Converts xcstrings plural forms to ICU format with metadata preservation - **Backward compatible**: Original xcode-xcstrings (v1) completely unchanged - **Opt-in migration**: Users explicitly choose v2 in their config - **Format preservation**: Maintains Objective-C format specifiers (%d, %.1f, %lld, %@) - **Variable handling**: Supports multiple variables with proper metadata - **CLDR support**: Handles all plural categories (zero, one, two, few, many, other) ## Implementation ### New Files - xcode-xcstrings-icu.ts - Core ICU conversion utilities (567 lines) - xcode-xcstrings-v2-loader.ts - V2 bucket loader (79 lines) - xcode-xcstrings-icu.spec.ts - 23 ICU conversion tests - xcode-xcstrings-lock-compatibility.spec.ts - 5 lock format tests - icu-safety.spec.ts - 22 safety tests for other bucket types ### Modified Files - loaders/index.ts - Register xcode-xcstrings-v2 bucket type - loaders/flat.ts - Add shouldPreserveObject option for ICU objects - loaders/variable/index.ts - ICU-aware metadata stripping - spec/formats.ts - Register xcode-xcstrings-v2 format ### Demo - demo/xcode-xcstrings-v2/ - Example files with ICU pluralization ## Lock File Format V1 (flattened): ``` item_count/one: <checksum> item_count/other: <checksum> ``` V2 (ICU object): ``` item_count: <checksum of ICU object> ``` ## Test Coverage - 72 total tests (50 new + 22 existing) - All 430 tests passing - Safety verified against 25+ bucket types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: fix formatting * chore: cleaning * chore: add changeset * chore: fix formatting --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent cb55c01 commit b45347c

File tree

17 files changed

+3699
-13
lines changed

17 files changed

+3699
-13
lines changed

.changeset/forty-readers-shop.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@lingo.dev/_spec": patch
3+
"lingo.dev": patch
4+
"@lingo.dev/_sdk": patch
5+
---
6+
7+
add an xcode-xcstrings-v2 bucket type that supports cldr pluralization rules

0 commit comments

Comments
 (0)