@@ -55,9 +55,22 @@ param(
5555 [switch ]$JsonOutput ,
5656
5757 [Parameter ()]
58- [switch ]$Quiet
58+ [switch ]$Quiet ,
59+
60+ [Parameter (HelpMessage = " Language for messages (en/es)" )]
61+ [ValidateSet (' en' , ' es' )]
62+ [string ]$Language
5963)
6064
65+ # Import localization module
66+ $ModulePath = Join-Path $PSScriptRoot " LocalizedMessages.psm1"
67+ if (Test-Path $ModulePath ) {
68+ Import-Module $ModulePath - Force
69+ if ($Language ) {
70+ Set-CurrentLanguage - Language $Language
71+ }
72+ }
73+
6174# =============================================================================
6275# Configuration
6376# =============================================================================
@@ -96,7 +109,14 @@ function Write-Status {
96109 " ERROR" { " Red" }
97110 default { " White" }
98111 }
99- Write-Host " [$Status ] $Message " - ForegroundColor $color
112+ # Use localized status labels if module is available
113+ $statusLabel = switch ($Status ) {
114+ " OK" { if (Get-Command Get-LocalizedMessage - ErrorAction SilentlyContinue) { Get-LocalizedMessage - Key ' common.success' } else { " OK" } }
115+ " WARN" { if (Get-Command Get-LocalizedMessage - ErrorAction SilentlyContinue) { Get-LocalizedMessage - Key ' common.warning' } else { " WARN" } }
116+ " ERROR" { if (Get-Command Get-LocalizedMessage - ErrorAction SilentlyContinue) { Get-LocalizedMessage - Key ' common.error' } else { " ERROR" } }
117+ default { if (Get-Command Get-LocalizedMessage - ErrorAction SilentlyContinue) { Get-LocalizedMessage - Key ' common.info' } else { " INFO" } }
118+ }
119+ Write-Host " [$statusLabel ] $Message " - ForegroundColor $color
100120 }
101121}
102122
@@ -286,6 +306,45 @@ function Test-DockerService {
286306# Main Execution
287307# =============================================================================
288308
309+ function Get-Msg {
310+ <#
311+ . SYNOPSIS
312+ Helper function to get localized message or fallback to English.
313+ #>
314+ param ([string ]$Key , [object []]$Args )
315+
316+ if (Get-Command Get-LocalizedMessage - ErrorAction SilentlyContinue) {
317+ return Get-LocalizedMessage - Key $Key - Args $Args
318+ }
319+ # Fallback messages
320+ $fallback = @ {
321+ ' docker.checking_installation' = ' Checking Docker Desktop installation...'
322+ ' docker.found_at' = ' Docker Desktop found at:'
323+ ' docker.checking_service' = ' Checking Docker service...'
324+ ' docker.checking_daemon' = ' Checking if Docker daemon is running...'
325+ ' docker.daemon_running' = ' Docker daemon is running'
326+ ' docker.getting_version' = ' Getting Docker version...'
327+ ' docker.version' = ' Docker version:'
328+ ' docker.version_meets_requirement' = ' Version meets minimum requirement'
329+ ' docker.version_below_minimum' = ' Version {0} is below minimum required ({1})'
330+ ' docker.not_installed' = ' Docker Desktop is not installed. Please download from https://www.docker.com/products/docker-desktop'
331+ ' docker.could_not_determine_version' = ' Could not determine Docker version'
332+ ' docker.all_good' = ' Docker Desktop is installed, running, and meets version requirements.'
333+ ' docker.installed_not_running' = ' Docker Desktop is installed but not running. Please start Docker Desktop.'
334+ ' docker.version_too_low' = ' Docker Desktop is running but version is below minimum required ({0}).'
335+ ' docker.status_summary' = ' Docker Desktop Status Summary'
336+ ' docker.installed' = ' Installed:'
337+ ' docker.running' = ' Running:'
338+ ' docker.version_ok' = ' Version OK:'
339+ ' docker.path' = ' Path:'
340+ ' docker.service_status' = ' Service:'
341+ ' docker.message' = ' Message:'
342+ }
343+ $msg = $fallback [$Key ]
344+ if ($msg -and $Args ) { $msg = $msg -f $Args }
345+ return $msg
346+ }
347+
289348function Get-DockerStatus {
290349 <#
291350 . SYNOPSIS
@@ -304,26 +363,26 @@ function Get-DockerStatus {
304363 }
305364
306365 # Check installation
307- Write-Status " Checking Docker Desktop installation... "
366+ Write-Status ( Get-Msg ' docker.checking_installation ' )
308367 $installCheck = Test-DockerInstalled
309368
310369 if (-not $installCheck.Installed ) {
311- $result.Message = " Docker Desktop is not installed. Please download from https://www. docker.com/products/docker-desktop "
370+ $result.Message = Get-Msg ' docker.not_installed '
312371 Write-Status $result.Message " ERROR"
313372 return $result
314373 }
315374
316375 $result.Installed = $true
317376 $result.Path = $installCheck.Path
318- Write-Status " Docker Desktop found at: $ ( $installCheck.Path ) " " OK"
377+ Write-Status " $ ( Get-Msg ' docker.found_at ' ) $ ( $installCheck.Path ) " " OK"
319378
320379 # Check service
321- Write-Status " Checking Docker service... "
380+ Write-Status ( Get-Msg ' docker.checking_service ' )
322381 $serviceCheck = Test-DockerService
323382 $result.ServiceStatus = $serviceCheck.Status
324383
325384 # Check if running
326- Write-Status " Checking if Docker daemon is running... "
385+ Write-Status ( Get-Msg ' docker.checking_daemon ' )
327386 $runningCheck = Test-DockerRunning
328387 $result.Running = $runningCheck.Running
329388
@@ -334,41 +393,41 @@ function Get-DockerStatus {
334393 # Still try to get version if docker CLI exists
335394 }
336395 else {
337- Write-Status " Docker daemon is running " " OK"
396+ Write-Status ( Get-Msg ' docker.daemon_running ' ) " OK"
338397 }
339398
340399 # Get version
341- Write-Status " Getting Docker version... "
400+ Write-Status ( Get-Msg ' docker.getting_version ' )
342401 $versionInfo = Get-DockerVersionInfo
343402
344403 if ($versionInfo.Success ) {
345404 $result.Version = $versionInfo.Version
346- Write-Status " Docker version: $ ( $versionInfo.Version ) " " OK"
405+ Write-Status " $ ( Get-Msg ' docker. version' ) $ ( $versionInfo.Version ) " " OK"
347406
348407 # Compare version
349408 $versionCompare = Compare-DockerVersion - CurrentVersion $versionInfo.Version - RequiredVersion $MinVersion
350409 $result.VersionOK = $versionCompare.MeetsRequirement
351410
352411 if ($versionCompare.MeetsRequirement ) {
353- Write-Status " Version meets minimum requirement ($MinVersion )" " OK"
412+ Write-Status " $ ( Get-Msg ' docker.version_meets_requirement ' ) ($MinVersion )" " OK"
354413 }
355414 else {
356- Write-Status " Version $ ( $versionInfo.Version ) is below minimum required ( $MinVersion )" " WARN"
415+ Write-Status ( Get-Msg ' docker.version_below_minimum ' - Args @ ($versionInfo.Version , $MinVersion )) " WARN"
357416 }
358417 }
359418 else {
360- Write-Status " Could not determine Docker version " " WARN"
419+ Write-Status ( Get-Msg ' docker.could_not_determine_version ' ) " WARN"
361420 }
362421
363422 # Final status message
364423 if ($result.Installed -and $result.Running -and $result.VersionOK ) {
365- $result.Message = " Docker Desktop is installed, running, and meets version requirements. "
424+ $result.Message = Get-Msg ' docker.all_good '
366425 }
367426 elseif ($result.Installed -and -not $result.Running ) {
368- $result.Message = " Docker Desktop is installed but not running. Please start Docker Desktop. "
427+ $result.Message = Get-Msg ' docker.installed_not_running '
369428 }
370429 elseif ($result.Installed -and $result.Running -and -not $result.VersionOK ) {
371- $result.Message = " Docker Desktop is running but version is below minimum required ($MinVersion ). "
430+ $result.Message = Get-Msg ' docker.version_too_low ' - Args @ ($MinVersion )
372431 }
373432
374433 return $result
@@ -384,16 +443,16 @@ if ($JsonOutput) {
384443else {
385444 Write-Host " "
386445 Write-Host " ======================================" - ForegroundColor Cyan
387- Write-Host " Docker Desktop Status Summary " - ForegroundColor Cyan
446+ Write-Host ( Get-Msg ' docker.status_summary ' ) - ForegroundColor Cyan
388447 Write-Host " ======================================" - ForegroundColor Cyan
389- Write-Host " Installed: $ ( $status.Installed ) "
390- Write-Host " Running: $ ( $status.Running ) "
391- Write-Host " Version: $ ( $status.Version ) "
392- Write-Host " Version OK: $ ( $status.VersionOK ) (minimum: $MinVersion )"
393- Write-Host " Path: $ ( $status.Path ) "
394- Write-Host " Service: $ ( $status.ServiceStatus ) "
448+ Write-Host " $ ( Get-Msg ' docker.installed ' ) $ ( $status.Installed ) "
449+ Write-Host " $ ( Get-Msg ' docker.running ' ) $ ( $status.Running ) "
450+ Write-Host " $ ( Get-Msg ' docker.version ' ) $ ( $status.Version ) "
451+ Write-Host " $ ( Get-Msg ' docker.version_ok ' ) $ ( $status.VersionOK ) (minimum: $MinVersion )"
452+ Write-Host " $ ( Get-Msg ' docker.path ' ) $ ( $status.Path ) "
453+ Write-Host " $ ( Get-Msg ' docker.service_status ' ) $ ( $status.ServiceStatus ) "
395454 Write-Host " "
396- Write-Host " Message: $ ( $status.Message ) "
455+ Write-Host " $ ( Get-Msg ' docker.message ' ) $ ( $status.Message ) "
397456 Write-Host " "
398457}
399458
0 commit comments