Repository navigation
[iOS] Fix resource language detection when project path contains OS - #23389
Conversation
|
|
OS
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23389/wasm-skia-net9/index.html |
There was a problem hiding this comment.
Pull request overview
This PR fixes iOS localization resource generation when absolute filesystem paths contain segments that look like locale qualifiers (e.g., .../OS/...), by basing qualifier parsing on MSBuild-provided item-relative paths (TargetPath) instead of the machine’s full path. It also adds a unit test to cover the absolute-path + relative-target-path scenario to prevent regressions.
Changes:
- Update
ResourcesGenerationTask_v0to parseResourceCandidateusingTargetPath(fallback:ItemSpec) for relative qualifier detection. - Add a unit test verifying correct logical path + language extraction when
ItemSpecis absolute butTargetPathis relative.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Uno.UI.Tests/Resources/Given_ResourceCandidate.cs | Adds regression test for parsing qualifiers from a relative target path even when the full path contains misleading segments like OS. |
| src/SourceGenerators/Uno.UI.Tasks/ResourcesGenerator/ResourcesGenerationTask.cs | Switches resource qualifier parsing to prefer MSBuild-relative TargetPath rather than absolute ItemSpec. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23389/wasm-skia-net9/index.html |
Language detection parsed the resource's full filesystem path, so any directory above the project whose name is a language tag was picked up as a qualifier. A project under a folder named `OS` (Ossetic) or `cs` (Czech) got that folder as its language, emitting `OS.lproj` on iOS and the wrong `values-*` on Android. Qualifiers are now read from the authored, project-relative path: `Link`, then a relative item spec, then the item spec with the defining/target project directory stripped. `TargetPath` alone is not enough, since AssignTargetPath collapses items outside the project cone to their bare file name, which would drop the language of resources referenced through a relative path such as `..\Shared\Strings\de\Resources.resw`. fixes #3157 fixes #4657 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01XTnhSeNXbqgHyJqjFdfNx2
ba3145b to
358e4ad
Compare
There was a problem hiding this comment.
🟡 Not ready to approve
The new resolver should normalize path separators before using Path.* APIs/returning the qualifier path, otherwise qualifier parsing can still break when metadata uses non-native separators (notably on macOS/Linux).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Suppressed comments (1)
src/SourceGenerators/Uno.UI.Tasks/ResourcesGenerator/ResourceQualifierPathResolver.cs:36
ResourceCandidate.Parserelies onPath.GetDirectoryName/Path.DirectorySeparatorChar, so if MSBuild providesLink/TargetPath/ItemSpecwith non-native separators (e.g.\on macOS/Linux), the current resolver may fail to detect directory structure and qualifiers, falling back to the absolute path (reintroducing theOS/cslanguage mis-detection). Normalize path separators up-front before runningPath.*APIs and returning the qualifier path.
if (string.IsNullOrEmpty(itemSpec) || !Path.IsPathRooted(itemSpec))
{
// A relative item spec is authored as-is and already relative to the project.
return itemSpec;
}
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
`Link` and `TargetPath` metadata keep the separator the project authored, while qualifiers are split on the build host's separator. A Windows-authored `\` therefore yields no folder qualifiers on a mac or Linux host. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VLFYcoiAFBfeEpH1R2MaNi
There was a problem hiding this comment.
🟢 Ready to approve
The fix is narrowly scoped, aligns with the reported issues, and includes focused unit tests that exercise the problematic path/metadata combinations.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23389/wasm-skia-net9/index.html |
closes #4657, closes #3157
PR Type:
🐞 Bugfix
What changed? 🚀
Localization resource generation for iOS could mis-detect language from absolute filesystem segments (e.g.,
.../OS/...) and emitOS.lprojinstead of real locale folders. This updates resource qualifier parsing to use MSBuild-relativeTargetPathwhen available, so locale extraction is based on project item path, not machine path.Resource generation fix
ResourcesGenerationTask_v0now parsesResourceCandidatefromTargetPath(fallback:ItemSpec), preventing parent directory names from being treated as language qualifiers.Regression coverage
Given_ResourceCandidatefor absolute full path + relative target path parsing to validate correct logical path and language extraction.PR Checklist ✅
Screenshots Compare Test Runresults.