Skip to content

Commit

Permalink
Check cldr-plurals (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati authored Oct 20, 2024
1 parent ab41672 commit 15e04a5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,38 @@ jobs:
throw "xgettext.exe didn't load the translations.`nIts output is:`n$stdout"
}
Write-Host "xgettext.exe correctly loaded the translations when LANGUAGE=$env:LANGUAGE`nIts localized output is`n$stdout"
-
name: Check cldr-plurals
shell: pwsh
run: |
$pot = @'
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Hi"
msgstr ""
'@
$lang = 'zu'
Remove-Item -LiteralPath Env:GETTEXTCLDRDIR -ErrorAction SilentlyContinue
$po = $pot | & .\files-unsigned\bin\msginit.exe --input=- --output-file=- --locale="$lang"
$rule = $po -match "Plural-Forms:"
if ($rule) {
throw "Without GETTEXTCLDRDIR there shouldn't be a Plural-Forms header in the .po file for the locale $lang."
}
Write-Output -InputObject "As expected, without GETTEXTCLDRDIR there isn't a Plural-Forms header in the .po file for the locale $lang."
if ('${{ steps.vars.outputs.cldr-plural-works }}' -eq 'yes') {
$env:GETTEXTCLDRDIR = "$PWD\files-unsigned\lib\gettext"
$po = $pot | & .\files-unsigned\bin\msginit.exe --input=- --output-file=- --locale="$lang"
$rule = $po -match "Plural-Forms:"
if (-not($rule)) {
throw "With GETTEXTCLDRDIR there should be a Plural-Forms header in the .po file for the locale $lang, but there isn't."
}
Write-Output -InputObject "With GETTEXTCLDRDIR there is a Plural-Forms header ($rule) in the .po file for the locale $lang."
}
-
name: Upload unsigned files
if: steps.vars.outputs.signpath-signing-policy
Expand Down
3 changes: 3 additions & 0 deletions build-exe/process-dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ class Binaries
$this.Root = Get-Item -LiteralPath $Path
$this.Items = @()
foreach ($file in Get-ChildItem -LiteralPath $this.Root.FullName -Recurse -File -Include *.exe,*.dll) {
if ($file.Extension -ne '.dll' -and $file.Extension -ne '.exe') {
continue;
}
$binary = [Binary]::new($file, $this.Root)
$this.Add($binary)
}
Expand Down
7 changes: 7 additions & 0 deletions build-exe/vars.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ if (-not($cygwinMirror)) {
throw 'Unable to reach any of the Cygwin mirrors'
}

$cldrPluralWorks = 'yes'
if ($Link -eq 'shared') {
# See https://savannah.gnu.org/bugs/?66356
$cldrPluralWorks = 'no'
}

Export-Variable -Name 'cygwin-mirror' -Value $cygwinMirror
Export-Variable -Name 'cygwin-packages' -Value "wget,file,make,unzip,dos2unix,mingw64-$architecture-gcc-core,mingw64-$architecture-gcc-g++,mingw64-$architecture-headers,mingw64-$architecture-runtime"
Export-Variable -Name 'cygwin-path' -Value $($cygwinPath -join ':')
Expand All @@ -428,6 +434,7 @@ Export-Variable -Name 'gettext-peversion-libintl' -Value $gettextPEVersionLibInt
Export-Variable -Name 'gettext-peversion-libtextstyle' -Value $gettextPEVersionLibTextStyle
Export-Variable -Name 'iconv-tp-version' -Value $iconvTPVersion
Export-Variable -Name 'gettext-tp-version' -Value $gettextTPVersion
Export-Variable -Name 'cldr-plural-works' -Value $cldrPluralWorks

Write-Output '## Outputs'
Get-Content -LiteralPath $env:GITHUB_OUTPUT

0 comments on commit 15e04a5

Please sign in to comment.