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
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):
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:
This yields:
What support for localization might look like (not sure about feasibility; solely based on noticing that some attributes accept script blocks):
Environment data