Skip to content

Add StrContains for language modes used in resource strings - #28339

Merged
Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
daxian-dbw:add-strcontains
Nov 5, 2026
Merged

Dongbo Wang (daxian-dbw) merged 2 commits into
PowerShell:masterfrom
daxian-dbw:add-strcontains

Conversation

@daxian-dbw

Copy link
Copy Markdown
Member

PR Summary

Add StrContains for language modes used in resource strings.
The language-mode words need to be locked so that they can be preserved in localized resources.

@daxian-dbw
Dongbo Wang (daxian-dbw) requested a review from a team as a code owner November 4, 2026 22:44
Copilot AI balanced review requested due to automatic review settings November 4, 2026 22:44
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the localization constraints and resource-message updates.

No open issues 🎉

What changed in this PR

This PR adds localization constraints to PowerShell resource strings so language-mode names remain unchanged in translations. It updates resource metadata and message wording without changing execution logic.

Changes:

  • Add StrContains annotations for language modes and related PowerShell keywords and identifiers.
  • Standardize message text to use NoLanguage, RestrictedLanguage, ConstrainedLanguage, and FullLanguage.
  • Remove stray quotation marks from three module log titles.
File Description
src/​System.Management.Automation/​resources/​SessionStateStrings.resx Protect the language-mode name in the variable-scope log message.
src/​System.Management.Automation/​resources/​SecuritySupportStrings.resx Protect the language-mode name in the script-trust log message.
src/​System.Management.Automation/​resources/​RunspaceStrings.resx Standardize and protect NoLanguage in the session error.
src/​System.Management.Automation/​resources/​RemotingErrorIdStrings.resx Protect session language-mode choices and normalize a log message.
src/​System.Management.Automation/​resources/​ParserStrings.resx Normalize language-mode names and protect parser keywords and identifiers.
src/​System.Management.Automation/​resources/​ParameterBinderStrings.resx Normalize and protect language-mode names in binding logs.
src/​System.Management.Automation/​resources/​Modules.resx Protect language-mode names and remove stray quotes from log titles.
src/​System.Management.Automation/​resources/​Metadata.resx Protect ValidateTrustedData and normalize the language-mode name.
src/​System.Management.Automation/​resources/​InternalCommandStrings.resx Normalize and protect language-mode names in command messages.
src/​System.Management.Automation/​resources/​ExtendedTypeSystem.resx Protect language-mode names in type-conversion logs.
src/​System.Management.Automation/​resources/​CommandBaseStrings.resx Protect language-mode names in dot-source and command-search logs.
src/​System.Management.Automation/​resources/​AutomationExceptions.resx Normalize and protect the language-mode name in the script-block log.
src/​Microsoft.PowerShell.Commands.Utility/​resources/​UtilityCommonStrings.resx Protect Invoke-Expression and ConstrainedLanguage.
src/​Microsoft.PowerShell.Commands.Utility/​resources/​NewObjectStrings.resx Protect language-mode names and COM in object-creation logs.
src/​Microsoft.PowerShell.Commands.Utility/​resources/​ImportLocalizedDataStrings.resx Protect SupportedCommand and ConstrainedLanguage.
src/​Microsoft.PowerShell.Commands.Utility/​resources/​AddTypeStrings.resx Protect Add-Type and ConstrainedLanguage.

Review effort: Balanced

@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit cbf293e into PowerShell:master Nov 5, 2026
42 of 43 checks passed
@daxian-dbw
Dongbo Wang (daxian-dbw) deleted the add-strcontains branch November 5, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.6.x-Consider Backport-7.7.x-Consider CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants