You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support localization of custom error messages for parameter validation attributes #3765
Now that at least some of the custom error messages for parameter validation attributes support custom error messages - see #3745, it should be possible to support localization of these error messages - currently, only literal strings are supported.
Without this ability, localized scripts are effectively prevented from using such validation attributes.
What currently works:
functionfoo {
param(
[ValidatePattern('o', ErrorMessage ='Must have an "o".')]
$bar
)
$bar
}
foo -bar baz
This yields:
foo : Cannot validate argument on parameter 'bar'. Must have an "o".
What support for localization might look like (not sure about feasibility; solely based on noticing that some attributes accept script blocks):
Thanks, Ilya (@iSazonov) - coming back here I'd forgotten that this issue is about enabling localization of a user-supplied message, not about localizing PowerShell's own messages (which is what #666 is about).
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 23, 2023
Activity
iSazonov commentedon May 12, 2017
Related #2728 (comment)
mmsaffari commentedon Jan 21, 2020
Are
HelpMessageBaseNameandHelpMessageResourceIdcurrently working?wbpluto commentedon Apr 18, 2020
Still waiting for this. Come on, Microsoft, your're a global company.
iSazonov commentedon Apr 20, 2020
Junwei Huang (@wbpluto) It is an open source project so you can pull PR.
mklement0 commentedon Apr 20, 2020
iSazonov commentedon Apr 21, 2020
Michael Klement (@mklement0) I only point that everybody can contribute and do not wait.
For the issue a solution was mentioned in #3765 (comment)
mklement0 commentedon Apr 21, 2020
Thanks, Ilya (@iSazonov) - coming back here I'd forgotten that this issue is about enabling localization of a user-supplied message, not about localizing PowerShell's own messages (which is what #666 is about).
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.