Skip to content

Commit

Permalink
xIisHandler: Moving strings to localization file (dsccommunity#511)
Browse files Browse the repository at this point in the history
- Changes to xIisHandler
  - Moved MSFT_xIisHandler localization strings to strings.psd1 (issue dsccommunity#463).
  • Loading branch information
Outek authored and Gregory Storme committed Feb 14, 2020
1 parent f0faae5 commit 829b1db
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Expand Up @@ -2,10 +2,6 @@

## Unreleased

- Changes to xIisLogging
- Moved MSFT_xIisLogging localization strings to strings.psd1 ([issue #464](https://github.com/PowerShell/xWebAdministration/issues/464)).
- Changes to xWebAppPoolDefaults
- Move localization strings to strings.psd1 file ([Issue #470](https://github.com/PowerShell/xWebAdministration/issues/470))
- Changes to xWebAdministration
- Changes to PULL\_REQUEST\_TEMPLATE.md
- Improving descriptive text around the CHANGELOG.md entry.
Expand All @@ -18,11 +14,12 @@
- Moved examples from Readme.md to respective `/Examples/Resources/`
folders ([issue #486](https://github.com/PowerShell/xWebAdministration/issues/486)).
- Created new folder structure for examples so that examples will be
placed in `/Examples/Resources/$resourceName` ([issue #483](https://github.com/PowerShell/xWebAdministration/issues/483))
placed in `/Examples/Resources/$resourceName` ([issue #483](https://github.com/PowerShell/xWebAdministration/issues/483)).
- Added a table of contents for the resource list ([issue #450](https://github.com/PowerShell/xWebAdministration/issues/450)).
- Alphabetized the resource list in the README.md ([issue #449](https://github.com/PowerShell/xWebAdministration/issues/449)).
- Changes to xIisHandler
- Updated schema.mof to include descriptions for each property ([issue #453](https://github.com/PowerShell/xWebAdministration/issues/453)).
- Moved MSFT_xIisHandler localization strings to strings.psd1 ([issue #463](https://github.com/PowerShell/xWebAdministration/issues/463)).
- Changes to xWebsite
- Fix `Get-TargetResource` so that `LogFlags` are returned as expected
array of strings (one for each flag) rather than an array containing
Expand All @@ -33,11 +30,14 @@
- Fix `Get-TargetResource` so that `LogFlags` are returned as expected
array of strings (one for each flag) rather than an array containing a
single comma-separated string of flags ([issue #332](https://github.com/PowerShell/xWebAdministration/issues/332)).
- Moved MSFT_xIisLogging localization strings to strings.psd1 ([issue #464](https://github.com/PowerShell/xWebAdministration/issues/464)).
- Changes to xSslSettings
- Updated casing of `xSslSettings` in all file names, folder names, schema, and documentation
([issue #461](https://github.com/PowerShell/xWebAdministration/issues/461)).
- Changes to xWebConfigKeyValue
- Updated schema.mof to include a description for the Ensure property ([issue #455](https://github.com/PowerShell/xWebAdministration/issues/455)).
- Changes to xWebAppPoolDefaults
- Move localization strings to strings.psd1 file ([issue #470](https://github.com/PowerShell/xWebAdministration/issues/470)).

## 2.8.0.0

Expand Down
31 changes: 9 additions & 22 deletions DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.psm1
Expand Up @@ -4,21 +4,8 @@ $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 @'
NoWebAdministrationModule = Please ensure that WebAdministration module is installed.
AddingHandler = Adding handler '{0}'
RemovingHandler = Removing handler '{0}'
HandlerExists = Handler with name '{0}' already exist
HandlerNotPresent = Handler with name '{0}' is not present as requested
HandlerNotSupported = The handler with name '{0}' is not supported.
VerboseGetTargetPresent = Handler is present
VerboseGetTargetAbsent = Handler is absent
'@
}
# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xIisHandler'

#region script variables
$script:handlers = @{
Expand Down Expand Up @@ -811,15 +798,15 @@ function Get-TargetResource

if ($null -eq $handler)
{
Write-Verbose -Message $LocalizedData.VerboseGetTargetAbsent
Write-Verbose -Message $script:localizedData.VerboseGetTargetAbsent
return @{
Ensure = 'Absent'
Name = $Name
}
}
else
{
Write-Verbose -Message $LocalizedData.VerboseGetTargetPresent
Write-Verbose -Message $script:localizedData.VerboseGetTargetPresent
return @{
Ensure = 'Present'
Name = $Name
Expand Down Expand Up @@ -863,7 +850,7 @@ function Set-TargetResource
{
# add the handler
Add-Handler -Name $Name
Write-Verbose -Message ($LocalizedData.AddingHandler -f $Name)
Write-Verbose -Message ($script:localizedData.AddingHandler -f $Name)
}
elseif ($null -ne $handler -and $Ensure -eq 'Absent')
{
Expand All @@ -872,7 +859,7 @@ function Set-TargetResource
-Filter $sectionNode `
-Name '.' `
-AtElement @{name="$Name"}
Write-Verbose -Message ($LocalizedData.RemovingHandler -f $Name)
Write-Verbose -Message ($script:localizedData.RemovingHandler -f $Name)
}
}
function Test-TargetResource
Expand Down Expand Up @@ -907,13 +894,13 @@ function Test-TargetResource
elseif ($null -ne $handler -and $Ensure -eq 'Present')
{
# Handler is present
Write-Verbose -Message ($LocalizedData.HandlerExists -f $Name)
Write-Verbose -Message ($script:localizedData.HandlerExists -f $Name)
return $true
}
else
{
# Handler not present and should not be there.
Write-Verbose -Message ($LocalizedData.HandlerNotPresent -f $Name)
Write-Verbose -Message ($script:localizedData.HandlerNotPresent -f $Name)
return $true
}
}
Expand Down Expand Up @@ -954,7 +941,7 @@ function Add-Handler
else
{
New-TerminatingError -ErrorId 'HandlerNotSupported' `
-ErrorMessage $($LocalizedData.HandlerNotSupported -f $Name) `
-ErrorMessage $($script:localizedData.HandlerNotSupported -f $Name) `
-ErrorCategory InvalidArgument
}
}
Expand Down
10 changes: 10 additions & 0 deletions DSCResources/MSFT_xIIsHandler/en-US/MSFT_xIIsHandler.strings.psd1
@@ -0,0 +1,10 @@
ConvertFrom-StringData @'
NoWebAdministrationModule = Please ensure that WebAdministration module is installed.
AddingHandler = Adding handler '{0}'.
RemovingHandler = Removing handler '{0}'.
HandlerExists = Handler with name '{0}' already exist.
HandlerNotPresent = Handler with name '{0}' is not present as requested.
HandlerNotSupported = Handler with name '{0}' is not supported.
VerboseGetTargetPresent = Handler is Present.
VerboseGetTargetAbsent = Handler is Absent.
'@

0 comments on commit 829b1db

Please sign in to comment.