From c41ae9fbf30bb534010eebdc505d0d9ed5f39cac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 27 Aug 2025 14:41:33 +0000 Subject: [PATCH 1/5] Initial plan From b7e8fd70ff3e85453361e9a312c70a2e84618ace Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 27 Aug 2025 14:50:07 +0000 Subject: [PATCH 2/5] Localize debug messages in Get-LocalizedDataForInvariantCulture.ps1 Co-authored-by: johlju <7189721+johlju@users.noreply.github.com> --- source/Public/Get-LocalizedDataForInvariantCulture.ps1 | 8 ++++---- source/en-US/DscResource.Common.strings.psd1 | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source/Public/Get-LocalizedDataForInvariantCulture.ps1 b/source/Public/Get-LocalizedDataForInvariantCulture.ps1 index 34c8f0b..43bf6b4 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,14 +119,14 @@ 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) } } @@ -136,7 +136,7 @@ function Get-LocalizedDataForInvariantCulture } 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..43e6be4 100644 --- a/source/en-US/DscResource.Common.strings.psd1 +++ b/source/en-US/DscResource.Common.strings.psd1 @@ -70,4 +70,10 @@ 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) '@ From 22ecc26a24b3a77b42e8fa50b55e4a90bfc2d851 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Wed, 27 Aug 2025 19:06:37 +0200 Subject: [PATCH 3/5] Localize hardcoded `Write-Debug` messages in `Get-LocalizedDataForInvariantCulture` --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) 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 From 654c60160341f32c303698df2e396fb0688c8c0a Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Wed, 27 Aug 2025 19:23:52 +0200 Subject: [PATCH 4/5] Fix formatting of localized message for Get-LocalizedDataForInvariantCulture --- source/en-US/DscResource.Common.strings.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/en-US/DscResource.Common.strings.psd1 b/source/en-US/DscResource.Common.strings.psd1 index 43e6be4..01d739f 100644 --- a/source/en-US/DscResource.Common.strings.psd1 +++ b/source/en-US/DscResource.Common.strings.psd1 @@ -72,7 +72,7 @@ ConvertFrom-StringData @' Test_ModuleExist_FilteringByPrerelease = Filtering modules by prerelease '{0}'. (DRC0058) ## Get-LocalizedDataForInvariantCulture - Get_LocalizedDataForInvariantCulture_GettingFile = Getting file {0}. (GLDFIC0001) + 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) From 58f88a568b6c35ffffea5d0cc84f4940fec2077d Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Wed, 27 Aug 2025 19:24:33 +0200 Subject: [PATCH 5/5] Localize error message for missing language file in Get-LocalizedDataForInvariantCulture --- source/Public/Get-LocalizedDataForInvariantCulture.ps1 | 2 +- source/en-US/DscResource.Common.strings.psd1 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Public/Get-LocalizedDataForInvariantCulture.ps1 b/source/Public/Get-LocalizedDataForInvariantCulture.ps1 index 43bf6b4..4e32148 100644 --- a/source/Public/Get-LocalizedDataForInvariantCulture.ps1 +++ b/source/Public/Get-LocalizedDataForInvariantCulture.ps1 @@ -132,7 +132,7 @@ function Get-LocalizedDataForInvariantCulture 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 { diff --git a/source/en-US/DscResource.Common.strings.psd1 b/source/en-US/DscResource.Common.strings.psd1 index 01d739f..4b12139 100644 --- a/source/en-US/DscResource.Common.strings.psd1 +++ b/source/en-US/DscResource.Common.strings.psd1 @@ -76,4 +76,5 @@ ConvertFrom-StringData @' 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) '@