Skip to content

fix: prioritize plural localization over simple strings in LocalLocalizationExtractor and LocalizationProvider#379

Open
serhii-londar wants to merge 4 commits intomasterfrom
#356
Open

fix: prioritize plural localization over simple strings in LocalLocalizationExtractor and LocalizationProvider#379
serhii-londar wants to merge 4 commits intomasterfrom
#356

Conversation

@serhii-londar
Copy link
Copy Markdown
Collaborator

@serhii-londar serhii-londar commented Feb 22, 2026

Closes #347

Copilot AI review requested due to automatic review settings February 22, 2026 20:52
@cursor
Copy link
Copy Markdown

cursor bot commented Feb 22, 2026

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
Copy link
Copy Markdown

codecov bot commented Feb 22, 2026

Codecov Report

❌ Patch coverage is 97.10145% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.64%. Comparing base (4f98b07) to head (61e2457).

Files with missing lines Patch % Lines
...ization/Extractor/LocalLocalizationExtractor.swift 92.31% 1 Missing ⚠️
...K/Localization/Provider/LocalizationProvider.swift 92.31% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .strings entry 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.

@andrii-bodnar andrii-bodnar linked an issue Mar 12, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS Plurals Not Working with Crowdin SDK

2 participants