mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-11-26 07:26:18 +01:00
Refactor feature label handling to utilize language catalogs (#890)
This commit is contained in:
+8
-4
@@ -322,8 +322,8 @@ $script:Features = @{}
|
||||
try {
|
||||
$featuresData = Get-Content -Path $script:FeaturesFilePath -Raw | ConvertFrom-Json
|
||||
foreach ($feature in $featuresData.Features) {
|
||||
if ([string]::IsNullOrWhiteSpace([string]$feature.FeatureId) -or [string]::IsNullOrWhiteSpace([string]$feature.Label) -or [string]::IsNullOrWhiteSpace([string]$feature.ApplyText)) {
|
||||
Write-Warning "Feature '$($feature.FeatureId)' is missing a FeatureId, Label, or ApplyText in Features.json and will be skipped."
|
||||
if ([string]::IsNullOrWhiteSpace([string]$feature.FeatureId)) {
|
||||
Write-Warning "A feature is missing a FeatureId in Features.json and will be skipped."
|
||||
continue
|
||||
}
|
||||
$script:Features[$feature.FeatureId] = $feature
|
||||
@@ -476,8 +476,9 @@ $WinVersion = Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\Current
|
||||
# Check if the machine supports Modern Standby, this is used to determine if the DisableModernStandbyNetworking option can be used
|
||||
$script:ModernStandbySupported = Test-ModernStandbySupport
|
||||
|
||||
# Explicit -Language takes precedence over saved UI preferences and the system culture.
|
||||
Initialize-UiPreferences -Language $Language
|
||||
# CLI menus, operation messages, and app selection always use English.
|
||||
$script:UiPreferences = Get-UiPreferences
|
||||
$script:Lang = Import-LanguageFile -LanguageCode 'en-US'
|
||||
|
||||
$script:Params = $PSBoundParameters
|
||||
$script:UndoParams = @{}
|
||||
@@ -574,6 +575,8 @@ if ((-not $script:Params.Count) -or $RunDefaults -or $RunDefaultsLite -or $RunSa
|
||||
}
|
||||
else {
|
||||
try {
|
||||
# Explicit -Language takes precedence over saved UI preferences and the system culture.
|
||||
Initialize-UiPreferences -Language $Language
|
||||
$result = Show-MainWindow
|
||||
|
||||
try {
|
||||
@@ -584,6 +587,7 @@ if ((-not $script:Params.Count) -or $RunDefaults -or $RunDefaultsLite -or $RunSa
|
||||
Exit
|
||||
}
|
||||
catch {
|
||||
$script:Lang = Import-LanguageFile -LanguageCode 'en-US'
|
||||
Write-Warning "The graphical interface could not start: $($_.Exception.Message)"
|
||||
Write-Verbose "GUI Failure details: $($_.Exception.ToString())"
|
||||
if (-not $Silent) {
|
||||
|
||||
Reference in New Issue
Block a user