@@ -287,15 +287,16 @@ $script:Strings = @{
287287 }
288288}
289289
290- # Resolve active language — match on primary culture tag, fall back to en-US
291- $culture = (Get-Culture ).Name # e.g. 'es-ES', 'en-US'
292- $primaryTag = $culture.Split (' -' )[0 ] # e.g. 'es', 'en'
290+ # Resolve active language — exact match first, then primary tag, then en-US fallback
291+ $culture = (Get-Culture ).Name # e.g. 'es-ES', 'en-US'
292+ $primaryTag = $culture.Split (' -' )[0 ] # e.g. 'es', 'en'
293293$resolvedLang = if ($script :Strings.ContainsKey ($culture )) {
294294 $culture
295- } elseif ($script :Strings.Keys -match " ^$primaryTag -" ) {
296- ($script :Strings.Keys | Where-Object { $_ -match " ^$primaryTag -" } | Select-Object - First 1 )
297295 } else {
298- ' en-US'
296+ $tagMatch = $script :Strings.Keys |
297+ Where-Object { $_ -match " ^$primaryTag -" } |
298+ Select-Object - First 1
299+ if ($tagMatch ) { $tagMatch } else { ' en-US' }
299300 }
300301$script :Lang = $script :Strings [$resolvedLang ]
301302
@@ -812,12 +813,15 @@ function Export-HtmlReport {
812813 Set-PhaseProgress - Activity (T ' PhaseReporting' ) - Status (T ' ProgReportCollect' ) - Current 1 - Total 3
813814
814815 $os = Get-CimInstance Win32_OperatingSystem
815- $cpu = (Get-CimInstance Win32_Processor | Select-Object - First 1 ).Name
816+ $cpu = ConvertTo-HtmlSafe (Get-CimInstance Win32_Processor | Select-Object - First 1 ).Name
817+ $osCaption = ConvertTo-HtmlSafe $os.Caption
816818 $ramGB = [math ]::Round($os.TotalVisibleMemorySize / 1 MB , 1 )
817819 $uptimeHrs = [math ]::Round(((Get-Date ) - $os.LastBootUpTime ).TotalHours, 1 )
818- $duration = (Get-Date ) - $script :StartTime
819- $durationFmt = ' {0:mm}m {0:ss}s' -f $duration
820- $timestamp = Get-Date - Format ' yyyy-MM-dd HH:mm:ss'
820+ $duration = (Get-Date ) - $script :StartTime
821+ $durationMins = [int ]$duration.TotalMinutes
822+ $durationSecs = $duration.Seconds
823+ $durationFmt = " ${durationMins} m ${durationSecs} s"
824+ $timestamp = Get-Date - Format ' yyyy-MM-dd HH:mm:ss'
821825
822826 Set-PhaseProgress - Activity (T ' PhaseReporting' ) - Status (T ' ProgReportBuild' ) - Current 2 - Total 3
823827
@@ -938,7 +942,7 @@ function Export-HtmlReport {
938942<h2>$lSysInfo </h2>
939943<div class="info-grid">
940944 <div class="info-card"><div class="label">$lHostname </div><div class="value">$env: COMPUTERNAME </div></div>
941- <div class="info-card"><div class="label">$lOS </div><div class="value">$ ( $os .Caption ) </div></div>
945+ <div class="info-card"><div class="label">$lOS </div><div class="value">$osCaption </div></div>
942946 <div class="info-card"><div class="label">$lCPU </div><div class="value">$cpu </div></div>
943947 <div class="info-card"><div class="label">$lRAM </div><div class="value">$ramGB GB</div></div>
944948 <div class="info-card"><div class="label">$lUptime </div><div class="value">$uptimeHrs $lHrs </div></div>
0 commit comments