diff --git a/CHANGELOG.md b/CHANGELOG.md index 7434cac..6a68220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Get-LocalizedDataForInvariantCulture` - Changed file processing message from `Write-Verbose` to `Write-Debug` for internal diagnostic information. + - Localized hardcoded `Write-Debug` messages to use localized strings + ([#169](https://github.com/dsccommunity/DscResource.Common/issues/169)). ### Fixed diff --git a/source/Public/Get-LocalizedDataForInvariantCulture.ps1 b/source/Public/Get-LocalizedDataForInvariantCulture.ps1 index 34c8f0b..4e32148 100644 --- a/source/Public/Get-LocalizedDataForInvariantCulture.ps1 +++ b/source/Public/Get-LocalizedDataForInvariantCulture.ps1 @@ -103,7 +103,7 @@ function Get-LocalizedDataForInvariantCulture { if ($FileName -match '\.psm1$|\.ps1$|\.psd1$') { - Write-Debug -Message 'Found an extension to the file name to search. Stripping...' + Write-Debug -Message $script:localizedData.Get_LocalizedDataForInvariantCulture_FoundExtension $FileName = $FileName -replace '\.psm1$|\.ps1$|\.psd1$' } @@ -119,24 +119,24 @@ function Get-LocalizedDataForInvariantCulture $filePath = [System.IO.Path]::Combine($localizedFolder, $localizedFileName) if (Test-Path -Path $filePath) { - Write-Debug -Message "Found '$filePath'." + Write-Debug -Message ($script:localizedData.Get_LocalizedDataForInvariantCulture_FoundFile -f $filePath) $languageFile = $filePath # Exit loop as we found the first filename. break } else { - Write-Debug -Message "File '$filePath' not found." + Write-Debug -Message ($script:localizedData.Get_LocalizedDataForInvariantCulture_FileNotFound -f $filePath) } } if ([string]::IsNullOrEmpty($languageFile)) { - throw ('File ''{0}'' not found in ''{1}''.' -f ($localizedFileNamesToTry -join ','),$localizedFolder) + throw ($script:localizedData.Get_LocalizedDataForInvariantCulture_FileNotFoundInFolder -f ($localizedFileNamesToTry -join ','), $localizedFolder) } else { - Write-Debug -Message ('Getting file {0}' -f $languageFile) + Write-Debug -Message ($script:localizedData.Get_LocalizedDataForInvariantCulture_GettingFile -f $languageFile) } $constrainedState = [System.Management.Automation.Runspaces.InitialSessionState]::Create() diff --git a/source/en-US/DscResource.Common.strings.psd1 b/source/en-US/DscResource.Common.strings.psd1 index aa1a242..4b12139 100644 --- a/source/en-US/DscResource.Common.strings.psd1 +++ b/source/en-US/DscResource.Common.strings.psd1 @@ -70,4 +70,11 @@ ConvertFrom-StringData @' Test_ModuleExist_FilteringByPath = Filtering modules by path '{0}'. (DRC0056) Test_ModuleExist_FilteringByVersion = Filtering modules by version '{0}'. (DRC0057) Test_ModuleExist_FilteringByPrerelease = Filtering modules by prerelease '{0}'. (DRC0058) + + ## Get-LocalizedDataForInvariantCulture + Get_LocalizedDataForInvariantCulture_GettingFile = Getting file '{0}'. (GLDFIC0001) + Get_LocalizedDataForInvariantCulture_FoundExtension = Found an extension to the file name to search. Stripping... (GLDFIC0002) + Get_LocalizedDataForInvariantCulture_FoundFile = Found '{0}'. (GLDFIC0003) + Get_LocalizedDataForInvariantCulture_FileNotFound = File '{0}' not found. (GLDFIC0004) + Get_LocalizedDataForInvariantCulture_FileNotFoundInFolder = File '{0}' not found in '{1}'. (GLDFIC0005) '@