Refactor translation handling across scripts

This commit is contained in:
Jeffrey
2026-10-21 19:45:58 +02:00
parent 97f3f805ef
commit 785f134153
12 changed files with 120 additions and 851 deletions
+8 -1
View File
@@ -7,6 +7,10 @@ BeforeAll {
function Wait-ForKeyPress {}
function Show-AppSelectionWindow { $false }
. (Join-Path $PSScriptRoot '..\Scripts\FileIO\Import-JsonFile.ps1')
. (Join-Path $PSScriptRoot '..\Scripts\FileIO\Import-LanguageFile.ps1')
$script:Lang = Import-LanguageFile -LanguageCode 'en-US' -LanguagesPath (Join-Path $PSScriptRoot '..\Config\Languages')
. (Join-Path $PSScriptRoot '..\Scripts\CLI\Write-CliHeader.ps1')
. (Join-Path $PSScriptRoot '..\Scripts\CLI\Write-PendingChanges.ps1')
. (Join-Path $PSScriptRoot '..\Scripts\CLI\Show-CliAppRemoval.ps1')
@@ -20,7 +24,7 @@ Describe 'Show-CliMenuOptions' {
BeforeEach {
$script:Params = @{}
$script:ControlParams = @('WhatIf', 'Silent')
$script:Features = @{ DisableTelemetry = [PSCustomObject]@{ Label = 'Disable telemetry' }; CreateRestorePoint = [PSCustomObject]@{ Label = 'Create restore point' } }
$script:Features = @{ DisableTelemetry = [PSCustomObject]@{ FeatureId = 'DisableTelemetry' }; CreateRestorePoint = [PSCustomObject]@{ FeatureId = 'CreateRestorePoint' } }
$script:SelectedApps = @('One.App', 'Two.App')
$script:SavedSettingsFilePath = 'C:\Settings\LastUsedSettings.json'
$script:DefaultSettingsFilePath = 'C:\Settings\DefaultSettings.json'
@@ -62,6 +66,9 @@ Describe 'Show-CliMenuOptions' {
Should -Invoke Generate-AppsList -Times 1 -Exactly
Should -Invoke Read-Host -Times 1 -Exactly
Should -Invoke Write-Output -Times 2 -ParameterFilter { $InputObject -like '- *' }
Should -Invoke Write-Output -Times 1 -Exactly -ParameterFilter {
$InputObject -eq "- $(Get-Translation -Key 'DisableTelemetry' -Field 'Label' -Section 'Features')"
}
}
It 'returns the saved-settings menu option only when the file is available' {