fix: prioritize plural localization over simple strings in LocalLocalizationExtractor and LocalizationProvider#379
fix: prioritize plural localization over simple strings in LocalLocalizationExtractor and LocalizationProvider#379serhii-londar wants to merge 4 commits intomasterfrom
Conversation
…izationExtractor and LocalizationProvider
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 17. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #379 +/- ##
==========================================
+ Coverage 56.21% 56.64% +0.43%
==========================================
Files 136 136
Lines 6377 6440 +63
==========================================
+ Hits 3584 3647 +63
Misses 2793 2793 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #347 by ensuring plural localizations from .stringsdict take precedence over simple .strings values when both define the same key, aligning SDK behavior with expected iOS pluralization rules.
Changes:
- Update
LocalizationProvider.localizedString(for:)to prefer plural lookups before falling back to simple strings. - Update
LocalLocalizationExtractor.localizedString(for:)with the same plural-first lookup behavior. - Add a regression test and a fallback
.stringsentry to simulate Crowdin exports where a plural key exists in both files.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Tests/UnitTests/BundleStringTests.swift | Adds a regression test for plural precedence when a key exists in both .strings and .stringsdict. |
| Tests/Tests/en.lproj/Localizable.strings | Adds a fallback non-plural string for a key that also exists in .stringsdict, simulating Crowdin output. |
| Sources/CrowdinSDK/CrowdinSDK/Localization/Provider/LocalizationProvider.swift | Changes provider lookup order to check plurals first, then simple strings. |
| Sources/CrowdinSDK/CrowdinSDK/Localization/Extractor/LocalLocalizationExtractor.swift | Changes extractor lookup order to check plurals first, then simple strings. |
Closes #347