feat: enhance localization handling by adding xcstringsParsingKey method and updating parsing logic#394
Open
serhii-londar wants to merge 2 commits intomasterfrom
Open
feat: enhance localization handling by adding xcstringsParsingKey method and updating parsing logic#394serhii-londar wants to merge 2 commits intomasterfrom
serhii-londar wants to merge 2 commits intomasterfrom
Conversation
…hod and updating parsing logic
There was a problem hiding this comment.
Pull request overview
This PR improves how the SDK resolves the localization key used when parsing .xcstrings files, particularly to support Crowdin custom languages whose folder locale can differ from the locale stored inside the xcstrings JSON.
Changes:
- Add
ManifestManager.xcstringsParsingKey(for:)to derive the correct xcstrings localization key (custom vs standard languages). - Update
.xcstringsparsing and download flow to use the derived parsing key instead of the raw iOS localization value.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
Sources/CrowdinSDK/Providers/Crowdin/ManifestManager/ManifestManager+LanguageResolver.swift |
Introduces xcstringsParsingKey(for:) to map an iOS localization to the key used inside .xcstrings files (custom-language aware). |
Sources/CrowdinSDK/Providers/Crowdin/LocalizationDownloader/CrowdinLocalizationDownloader.swift |
Uses xcstringsParsingKey(for:) when parsing cached xcstrings and when downloading/parsing xcstrings files. |
Comments suppressed due to low confidence (1)
Sources/CrowdinSDK/Providers/Crowdin/LocalizationDownloader/CrowdinLocalizationDownloader.swift:88
- Typo in local variable name:
xcStringsFilesToDownlaodis misspelled, which makes the code harder to read/search. Rename toxcStringsFilesToDownload(and update references) for clarity.
let xcStringsFilesToDownlaod = xcstringsFiles.filter({ self.manifestManager.hasFileChanged(filePath: $0, localization: self.manifestManager.xcstringsLanguage) })
let filesToDownload = xcStringsFilesToDownlaod + notXcstringsFilesToDownload
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #394 +/- ##
==========================================
- Coverage 57.30% 56.60% -0.69%
==========================================
Files 134 134
Lines 6540 6622 +82
==========================================
+ Hits 3747 3748 +1
- Misses 2793 2874 +81 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Fix spelling: 'wont' -> 'won't' in CrowdinLocalizationDownloader - Normalize unknown language fallback to BCP 47 in xcstringsParsingKey - Return language.iOSLanguageCode for standard languages (ensures BCP 47 output) - Update doc comment to clarify expected input/output formats - Add unit tests for standard, underscore-normalized, and custom language cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.