Add persistent output locale override setting - #6310
Conversation
* Add output.locale setting and schema support * Apply runtime language qualifier override for resource resolution * Include localized resw fallbacks in dev package and update docs/release notes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Flor Chacón (florelis)
left a comment
There was a problem hiding this comment.
LGTM, but I'd want to hold off on merging until we have a plan for what to do with App Installer.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This comment was marked as outdated.
This comment was marked as outdated.
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Looks like we will need to reset the override in App Installer. Internal PR number for that: 16173490 |
|
Question from internal discussion: |
|
|
||
| bool SetLanguageOverride(std::string_view localeTag) | ||
| { | ||
| return Loader::Instance().SetLanguageOverride(Utility::ConvertToUTF16(localeTag)); |
There was a problem hiding this comment.
Nit: Assuming this is done before any localized strings are fetched, this is going to create a loader with default options, and then immediately overwrite it with a new one that uses the locale. We could make it so that we only needed to create it once, but that's probably too small a gain to care.
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Grrr, pesky build failures |
…tput-locale-override
|
Flor Chacón (@florelis) - I've merged the latest changes from
|
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
ApplyOutputLocaleOverride() unconditionally triggered Loader::Instance()
at startup for every command, including dscv3 --manifest which runs
winget.exe unpackaged during the WinGetGenerateDSCv3Manifests build step.
The Loader() constructor had been refactored to call CreateLoader({}),
which calls ResourceContext::ResetGlobalQualifierValues() before
ResourceLoader(). This broke the safety guard that the original code
relied on: when unpackaged and resource.pri is not found, ResourceLoader()
throws a catchable hresult_error, preventing execution from reaching
ResourceLoader::GetForViewIndependentUse which fast-fails with an
uncatchable crash (0xC0000409 STATUS_STACK_BUFFER_OVERRUN) when not
under a debugger.
Two fixes:
- Restore the original constructor initialization path (without calling
CreateLoader) so the ResourceLoader() probe is not interfered with
- Guard ApplyOutputLocaleOverride to skip loader initialization entirely
when no locale override is configured (the common case)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Root Cause AnalysisNote This comment was authored by GitHub Copilot. Root cause: The original code relied on FixTwo changes applied in commit 25c246a:
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |

📖 Description
Add a persistent
output.localeuser setting that allows overriding winget interface string resolution by BCP47 tag.Current implementation details:
.output.localeat CLI startup and applies the override only when the setting is non-empty.Resource::SetLanguageOverride, which sets the MRTLanguagequalifier for winget resource loading.wil::srwlockin the shared resource loader for synchronized read/write access when resolving strings and updating locale override.This PR also updates settings schema/documentation and local package resource fallback handling for localized
winget.reswfiles.🔗 References
Resolves #422
🤖 Copilot Assistance
This PR includes changes authored with GitHub Copilot assistance.
🔍 Validation
OutputLocalesetting parsing/normalization behavior.output.localechanges.✅ Checklist
📋 Issue Type
Microsoft Reviewers: Open in CodeFlow