From 2ff8b5d512ceabfd523eda7827f95c30c49e2b0e Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Thu, 14 Feb 2019 10:48:45 -0800 Subject: [PATCH] Make new error messages into resource strings --- .../UseCompatibleCommands.cs | 4 +- .../CompatibilityRules/UseCompatibleTypes.cs | 4 +- Rules/Strings.Designer.cs | 39 ++++++++++++++++--- Rules/Strings.resx | 11 +++++- 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/Rules/CompatibilityRules/UseCompatibleCommands.cs b/Rules/CompatibilityRules/UseCompatibleCommands.cs index b8d7db85f..888ce707a 100644 --- a/Rules/CompatibilityRules/UseCompatibleCommands.cs +++ b/Rules/CompatibilityRules/UseCompatibleCommands.cs @@ -231,7 +231,7 @@ public static CommandCompatibilityDiagnostic Create( { string message = string.Format( CultureInfo.CurrentCulture, - Strings.UseCompatibleCommandsError, + Strings.UseCompatibleCommandsCommandError, commandName, platform.PowerShell.Version, platform.OperatingSystem.FriendlyName); @@ -269,7 +269,7 @@ public static CommandCompatibilityDiagnostic CreateForParameter( { string message = string.Format( CultureInfo.CurrentCulture, - "The parameter '{0}' is not available for command '{1}' in PowerShell '{2}' on '{3}'", + Strings.UseCompatibleCommandsParameterError, parameterName, commandName, platform.PowerShell.Version, diff --git a/Rules/CompatibilityRules/UseCompatibleTypes.cs b/Rules/CompatibilityRules/UseCompatibleTypes.cs index 9b1d7638a..e2ad774e9 100644 --- a/Rules/CompatibilityRules/UseCompatibleTypes.cs +++ b/Rules/CompatibilityRules/UseCompatibleTypes.cs @@ -603,7 +603,7 @@ public static TypeCompatibilityDiagnostic CreateForStaticMethod( { string message = String.Format( CultureInfo.CurrentCulture, - "The method '{0}' on type '{1}' is not available in PowerShell {2} on platform '{3}'", + Strings.UseCompatibleTypesMethodError, methodName, typeName, platform.PowerShell.Version, @@ -645,7 +645,7 @@ public static TypeCompatibilityDiagnostic CreateForStaticProperty( { string message = String.Format( CultureInfo.CurrentCulture, - "The member '{0}' on type '{1}' is not available in PowerShell {2} on platform '{3}'", + Strings.UseCompatibleTypesMemberError, propertyName, typeName, platform.PowerShell.Version, diff --git a/Rules/Strings.Designer.cs b/Rules/Strings.Designer.cs index f54c8e336..49fd55aea 100644 --- a/Rules/Strings.Designer.cs +++ b/Rules/Strings.Designer.cs @@ -2049,6 +2049,15 @@ internal static string UseCompatibleCmdletsName { } } + /// + /// Looks up a localized string similar to The command '{0}' is not available by default in PowerShell version '{1}' on platform '{2}'. + /// + internal static string UseCompatibleCommandsCommandError { + get { + return ResourceManager.GetString("UseCompatibleCommandsCommandError", resourceCulture); + } + } + /// /// Looks up a localized string similar to Use compatible commands. /// @@ -2068,20 +2077,20 @@ internal static string UseCompatibleCommandsDescription { } /// - /// Looks up a localized string similar to The command '{0}' is not available by default in PowerShell version '{1}' on platform '{2}'. + /// Looks up a localized string similar to UseCompatibleCommands. /// - internal static string UseCompatibleCommandsError { + internal static string UseCompatibleCommandsName { get { - return ResourceManager.GetString("UseCompatibleCommandsError", resourceCulture); + return ResourceManager.GetString("UseCompatibleCommandsName", resourceCulture); } } /// - /// Looks up a localized string similar to UseCompatibleCommands. + /// Looks up a localized string similar to The parameter '{0}' is not available for command '{1}' by default in PowerShell version '{2}' on platform '{3}'. /// - internal static string UseCompatibleCommandsName { + internal static string UseCompatibleCommandsParameterError { get { - return ResourceManager.GetString("UseCompatibleCommandsName", resourceCulture); + return ResourceManager.GetString("UseCompatibleCommandsParameterError", resourceCulture); } } @@ -2148,6 +2157,24 @@ internal static string UseCompatibleTypesDescription { } } + /// + /// Looks up a localized string similar to The member '{0}' is not available on type '{1}' by default in PowerShell version '{2}' on platform '{3}'. + /// + internal static string UseCompatibleTypesMemberError { + get { + return ResourceManager.GetString("UseCompatibleTypesMemberError", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The method '{0}' is not available on type '{1}' by default in PowerShell version '{2}' on platform '{3}'. + /// + internal static string UseCompatibleTypesMethodError { + get { + return ResourceManager.GetString("UseCompatibleTypesMethodError", resourceCulture); + } + } + /// /// Looks up a localized string similar to UseCompatibleTypes. /// diff --git a/Rules/Strings.resx b/Rules/Strings.resx index 8ea17b984..48861402c 100644 --- a/Rules/Strings.resx +++ b/Rules/Strings.resx @@ -819,9 +819,12 @@ Use commands compatible with the given PowerShell version and operating system - + The command '{0}' is not available by default in PowerShell version '{1}' on platform '{2}' + + The parameter '{0}' is not available for command '{1}' by default in PowerShell version '{2}' on platform '{3}' + UseCompatibleTypes @@ -834,6 +837,12 @@ The type '{0}' is not available by default in PowerShell version '{1}' on platform '{2}' + + The method '{0}' is not available on type '{1}' by default in PowerShell version '{2}' on platform '{3}' + + + The member '{0}' is not available on type '{1}' by default in PowerShell version '{2}' on platform '{3}' + UseCompatibleSyntax