Commit b45347c
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- .changeset
- packages
- cli
- demo/xcode-xcstrings-v2
- src/cli/loaders
- variable
- sdk/src
- spec/src
17 files changed
+3699
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments