Skip to content

Commit

Permalink
provide summary
Browse files Browse the repository at this point in the history
  • Loading branch information
thewahome committed Oct 15, 2024
1 parent 7eee5b5 commit c3e6f44
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/check-translations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ foreach ($file in Get-ChildItem -Path "vscode/microsoft-kiota/l10n" -Filter bund
if ($missing) {
$untranslatedItems = $missing | ForEach-Object { "<li>$_</li>" }
$results += [PSCustomObject]@{
"LanguageFile" = "$($file.Name) ($($untranslatedItems.Count) found)"
"LanguageFile" = "$($file.Name)"
"Count" = "$($untranslatedItems.Count) found"
"UntranslatedStrings" = "<ul>$($untranslatedItems -join "`n")</ul>"
}
}
Expand Down Expand Up @@ -55,7 +56,7 @@ $htmlTable = @"
"@

foreach ($result in $results) {
$htmlTable += "<tr><td>$($result.LanguageFile)</td><td>$($result.UntranslatedStrings)</td></tr>"
$htmlTable += "<tr><td>$($result.LanguageFile) ($($result.Count))</td><td>$($result.UntranslatedStrings)</td></tr>"
}

$htmlTable += @"
Expand All @@ -66,8 +67,14 @@ $htmlTable += @"

$htmlTable | Out-File -FilePath "untranslated_strings.html"

# Output a summary table to the workflow log
if ($results.Count -gt 0) {
Write-Host "Untranslated strings found. See untranslated_strings.html for details." -ForegroundColor Red
Write-Host "| Language File | Count |"
Write-Host "|----------------------------------------|---------|"
foreach ($result in $results) {
Write-Host "| $($result.LanguageFile) | $($result.Count) |"
}
}
else {
Write-Host "All strings have translations." -ForegroundColor Green
Expand Down

0 comments on commit c3e6f44

Please sign in to comment.