#You will need Microsoft Copilot CLI installed to run this script use this to install the command line tool: # winget install Microsoft.Copilot # pwsh ./Translate-Locale.ps1 ` # -SourceFile "./public/locales/en-GB/common.json" ` # -TargetLocale "fr-FR" ` # -OutputFile "./public/locales/fr-FR/common.json" # pwsh ./Translate-Locale.ps1 ` # -SourceFile "./public/locales/en-GB/common.json" ` # -TargetLocale "en-US" ` # -OutputFile "./public/locales/en-US/common.json" # pwsh ./Translate-Locale.ps1 ` # -SourceFile "./public/locales/en-GB/common.json" ` # -TargetLocale "fr-CA" ` # -OutputFile "./public/locales/fr-CA/common.json" param( [Parameter(Mandatory=$true)] [string]$SourceFile, # en-GB.json [Parameter(Mandatory=$true)] [string]$TargetLocale, # fr-FR, fr-CA, en-US, etc. [Parameter(Mandatory=$true)] [string]$OutputFile # output JSON file ) # Load the source JSON $sourceJson = Get-Content $SourceFile -Raw # Build the translation prompt $prompt = @" Translate the following JSON values into $TargetLocale. Keep the keys exactly the same. Return valid JSON only. $sourceJson "@ # Call Copilot CLI $translated = copilot $prompt # Save the result $translated | Out-File $OutputFile -Encoding UTF8 Write-Host "Generated $TargetLocale translation: $OutputFile"