diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fec866eb..82107dafb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ `Invoke-SqlScript` so that `PRINT` statements is outputted correctly when verbose output is requested, e.g `Start-DscConfiguration -Verbose`. + - Added en-US localization ([issue #624](https://github.com/PowerShell/SqlServerDsc/issues/624)). - Changes to SqlScriptQuery - Correctly passes the `$VerbosePreference` to the helper function `Invoke-SqlScript` so that `PRINT` statements is outputted correctly diff --git a/DSCResources/MSFT_SqlScript/MSFT_SqlScript.psm1 b/DSCResources/MSFT_SqlScript/MSFT_SqlScript.psm1 index 3197d99bd..bc2b8e4be 100644 --- a/DSCResources/MSFT_SqlScript/MSFT_SqlScript.psm1 +++ b/DSCResources/MSFT_SqlScript/MSFT_SqlScript.psm1 @@ -7,6 +7,8 @@ Import-Module -Name (Join-Path -Path $script:localizationModulePath -ChildPath ' $script:resourceHelperModulePath = Join-Path -Path $script:modulesFolderPath -ChildPath 'DscResource.Common' Import-Module -Name (Join-Path -Path $script:resourceHelperModulePath -ChildPath 'DscResource.Common.psm1') +$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_SqlScript' + <# .SYNOPSIS Returns the current state of the SQL Server features. @@ -90,6 +92,10 @@ function Get-TargetResource ErrorAction = 'Stop' } + Write-Verbose -Message ( + $script:localizedData.ExecutingGetScript -f $GetFilePath, $ServerInstance + ) + $result = Invoke-SqlScript @invokeParameters $getResult = Out-String -InputObject $result @@ -177,6 +183,10 @@ function Set-TargetResource $Variable ) + Write-Verbose -Message ( + $script:localizedData.ExecutingSetScript -f $SetFilePath, $ServerInstance + ) + $invokeParameters = @{ ServerInstance = $ServerInstance InputFile = $SetFilePath @@ -261,8 +271,16 @@ function Test-TargetResource $Variable ) + Write-Verbose -Message ( + $script:localizedData.TestingConfiguration + ) + try { + Write-Verbose -Message ( + $script:localizedData.ExecutingTestScript -f $TestFilePath, $ServerInstance + ) + $invokeParameters = @{ ServerInstance = $ServerInstance InputFile = $TestFilePath @@ -277,10 +295,18 @@ function Test-TargetResource if ($null -eq $result) { + Write-Verbose -Message ( + $script:localizedData.InDesiredState + ) + return $true } else { + Write-Verbose -Message ( + $script:localizedData.NotInDesiredState + ) + return $false } } diff --git a/DSCResources/MSFT_SqlScript/en-US/MSFT_SqlScript.strings.psd1 b/DSCResources/MSFT_SqlScript/en-US/MSFT_SqlScript.strings.psd1 new file mode 100644 index 000000000..69f3e85bf --- /dev/null +++ b/DSCResources/MSFT_SqlScript/en-US/MSFT_SqlScript.strings.psd1 @@ -0,0 +1,10 @@ +# Localized resources for SqlSetup + +ConvertFrom-StringData @' + ExecutingGetScript = Executing the Get script from the file path '{0}' on the instance '{1}'. + ExecutingSetScript = Executing the Set script from the file path '{0}' on the instance '{1}'. + ExecutingTestScript = Executing the Test script from the file path '{0}' on the instance '{1}'. + TestingConfiguration = Determines if the configuration in the Set script is in desired state. + InDesiredState = The configuration is in desired state. + NotInDesiredState = The configuration is not in desired state. +'@