From e1f3872dbd21031e0257345ec83e0518e26eaefa Mon Sep 17 00:00:00 2001 From: Daniel Siegenthaler Date: Sat, 5 Oct 2019 09:37:47 +0200 Subject: [PATCH 1/4] MSFT_xIisModule: Move localization strings to strings.psd1 --- .../MSFT_xIisModule/MSFT_xIisModule.psm1 | 24 +++---------------- .../en-US/MSFT_xIisModule.strings.psd1 | 16 +++++++++++++ 2 files changed, 19 insertions(+), 21 deletions(-) create mode 100644 DSCResources/MSFT_xIisModule/en-US/MSFT_xIisModule.strings.psd1 diff --git a/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 b/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 index 6fffbda87..4a3bf1b33 100644 --- a/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 +++ b/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 @@ -4,27 +4,9 @@ $script:localizationModulePath = Join-Path -Path $script:modulesFolderPath -Chil Import-Module -Name (Join-Path -Path $script:localizationModulePath -ChildPath 'xWebAdministration.Common.psm1') -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - VerboseGetTargetResource = Get-TargetResource has been run. - VerboseSetTargetRemoveHandler = Removing handler - VerboseSetTargetAddHandler = Adding handler. - VerboseSetTargetAddfastCgi = Adding fastCgi. - VerboseTestTargetResource = Get-TargetResource has been run. - VerboseGetIisHandler = Getting Handler for {0} in Site {1} - VerboseTestTargetResourceImplVerb = Matched Verb {0} - VerboseTestTargetResourceImplExtraVerb = Extra Verb {0} - VerboseTestTargetResourceImplRequestPath = RequestPath is {0} - VerboseTestTargetResourceImplPath = Path is {0} - VerboseTestTargetResourceImplresourceStatusRequestPath = StatusRequestPath is {0} - VerboseTestTargetResourceImplresourceStatusPath = StatusPath is {0} - VerboseTestTargetResourceImplModulePresent = Module present is {0} - VerboseTestTargetResourceImplModuleConfigured = ModuleConfigured is {0} -'@ -} +# Import Localization Strings +$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xIisModule' + function Get-TargetResource { <# diff --git a/DSCResources/MSFT_xIisModule/en-US/MSFT_xIisModule.strings.psd1 b/DSCResources/MSFT_xIisModule/en-US/MSFT_xIisModule.strings.psd1 new file mode 100644 index 000000000..8f6652494 --- /dev/null +++ b/DSCResources/MSFT_xIisModule/en-US/MSFT_xIisModule.strings.psd1 @@ -0,0 +1,16 @@ +ConvertFrom-StringData @' + VerboseGetTargetResource = Get-TargetResource has been run. + VerboseSetTargetRemoveHandler = Removing handler. + VerboseSetTargetAddHandler = Adding handler. + VerboseSetTargetAddfastCgi = Adding fastCgi. + VerboseTestTargetResource = Get-TargetResource has been run. + VerboseGetIisHandler = Getting Handler for '{0}' in Site '{1}'. + VerboseTestTargetResourceImplVerb = Matched Verb '{0}'. + VerboseTestTargetResourceImplExtraVerb = Extra Verb '{0}'. + VerboseTestTargetResourceImplRequestPath = RequestPath is '{0}'. + VerboseTestTargetResourceImplPath = Path is '{0}'. + VerboseTestTargetResourceImplresourceStatusRequestPath = StatusRequestPath is '{0}'. + VerboseTestTargetResourceImplresourceStatusPath = StatusPath is '{0}'. + VerboseTestTargetResourceImplModulePresent = Module present is '{0}'. + VerboseTestTargetResourceImplModuleConfigured = ModuleConfigured is '{0}'. +'@ From af95a1f27897e96ccb91137d3eedddbddd79e572 Mon Sep 17 00:00:00 2001 From: Daniel Siegenthaler Date: Sat, 5 Oct 2019 10:19:51 +0200 Subject: [PATCH 2/4] fixing localizedData --- .../MSFT_xIisModule/MSFT_xIisModule.psm1 | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 b/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 index 4a3bf1b33..c76195992 100644 --- a/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 +++ b/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 @@ -72,7 +72,7 @@ function Get-TargetResource } } - Write-Verbose -Message $LocalizedData.VerboseGetTargetResource + Write-Verbose -Message $script:localizedData.VerboseGetTargetResource $returnValue = @{ Path = $handler.ScriptProcessor @@ -135,13 +135,13 @@ function Set-TargetResource { if ($resourceTests.ModulePresent -and -not $resourceTests.ModuleConfigured) { - Write-Verbose -Message $LocalizedData.VerboseSetTargetRemoveHandler + Write-Verbose -Message $script:localizedData.VerboseSetTargetRemoveHandler Remove-IisHandler } if (-not $resourceTests.ModulePresent -or -not $resourceTests.ModuleConfigured) { - Write-Verbose -Message $LocalizedData.VerboseSetTargetAddHandler + Write-Verbose -Message $script:localizedData.VerboseSetTargetAddHandler Add-webconfiguration /system.webServer/handlers iis:\ -Value @{ Name = $Name Path = $RequestPath @@ -153,7 +153,7 @@ function Set-TargetResource if (-not $resourceTests.EndPointSetup) { - Write-Verbose -Message $LocalizedData.VerboseSetTargetAddfastCgi + Write-Verbose -Message $script:localizedData.VerboseSetTargetAddfastCgi Add-WebConfiguration /system.webServer/fastCgi iis:\ -Value @{ FullPath = $Path } @@ -161,7 +161,7 @@ function Set-TargetResource } else { - Write-Verbose -Message $LocalizedData.VerboseSetTargetRemoveHandler + Write-Verbose -Message $script:localizedData.VerboseSetTargetRemoveHandler Remove-IisHandler } } @@ -205,7 +205,7 @@ function Test-TargetResource $getParameters = Get-PSBoundParameters -FunctionParameters $PSBoundParameters $resourceStatus = Get-TargetResource @GetParameters - Write-Verbose -Message $LocalizedData.VerboseTestTargetResource + Write-Verbose -Message $script:localizedData.VerboseTestTargetResource return (Test-TargetResourceImpl @PSBoundParameters -ResourceStatus $resourceStatus).Result } @@ -271,7 +271,7 @@ function Get-IisHandler [String] $SiteName ) - Write-Verbose -Message ($LocalizedData.VerboseGetIisHandler -f $Name,$SiteName) + Write-Verbose -Message ($script:localizedData.VerboseGetIisHandler -f $Name,$SiteName) return Get-Webconfiguration -Filter 'System.WebServer/handlers/*' ` -PSPath (Get-IisSitePath ` -SiteName $SiteName) | ` @@ -346,13 +346,13 @@ function Test-TargetResourceImpl { if ($Verb -icontains $thisVerb) { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplVerb ` + Write-Verbose -Message ($script:localizedData.VerboseTestTargetResourceImplVerb ` -f $Verb) $matchedVerbs += $thisVerb } else { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplExtraVerb ` + Write-Verbose -Message ($script:localizedData.VerboseTestTargetResourceImplExtraVerb ` -f $Verb) $mismatchVerbs += $thisVerb } @@ -364,13 +364,13 @@ function Test-TargetResourceImpl $modulePresent = $true } - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplRequestPath ` + Write-Verbose -Message ($script:localizedData.VerboseTestTargetResourceImplRequestPath ` -f $RequestPath) - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplPath ` + Write-Verbose -Message ($script:localizedData.VerboseTestTargetResourceImplPath ` -f $Path) - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplresourceStatusRequestPath ` + Write-Verbose -Message ($script:localizedData.VerboseTestTargetResourceImplresourceStatusRequestPath ` -f $($resourceStatus.RequestPath)) - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplresourceStatusPath ` + Write-Verbose -Message ($script:localizedData.VerboseTestTargetResourceImplresourceStatusPath ` -f $($resourceStatus.Path)) $moduleConfigured = $false @@ -383,9 +383,9 @@ function Test-TargetResourceImpl $moduleConfigured = $true } - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplModulePresent ` + Write-Verbose -Message ($script:localizedData.VerboseTestTargetResourceImplModulePresent ` -f $ModulePresent) - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplModuleConfigured ` + Write-Verbose -Message ($script:localizedData.VerboseTestTargetResourceImplModuleConfigured ` -f $ModuleConfigured) if ($moduleConfigured -and ($ModuleType -ne 'FastCgiModule' -or $resourceStatus.EndPointSetup)) { From d823939bc62e7f1cb34989af2986589849db30c7 Mon Sep 17 00:00:00 2001 From: Daniel Siegenthaler Date: Sat, 5 Oct 2019 10:23:04 +0200 Subject: [PATCH 3/4] modified CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1154d7b77..43568d54b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Changes to xWebAdministration + - Moved xIisModule localization strings to strings.psd1. - Resolved custom Script Analyzer rules that was added to the test framework. - Moved change log from README.md to a separate CHANGELOG.md ([issue #446](https://github.com/PowerShell/xWebAdministration/issues/446)). - Remove example 'Creating the default website using configuration data' from README.md ([issue #488](https://github.com/PowerShell/xWebAdministration/issues/488)). From b1e252e618b70b1905576ee6cc12addcd01a55ff Mon Sep 17 00:00:00 2001 From: Daniel Siegenthaler Date: Sun, 6 Oct 2019 09:35:13 +0200 Subject: [PATCH 4/4] Fixing Changelog entry --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43568d54b..59c6d9c07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## Unreleased +- Changes to xIisModule entry + - Moved xIisModule localization strings to strings.psd1 ([issue #466](https://github.com/PowerShell/xWebAdministration/issues/466)). - Changes to xWebAdministration - - Moved xIisModule localization strings to strings.psd1. - Resolved custom Script Analyzer rules that was added to the test framework. - Moved change log from README.md to a separate CHANGELOG.md ([issue #446](https://github.com/PowerShell/xWebAdministration/issues/446)). - Remove example 'Creating the default website using configuration data' from README.md ([issue #488](https://github.com/PowerShell/xWebAdministration/issues/488)).