I've added tests for localization to Sqitch, which requires that the POSIX setlocale() function return an appropriate value. A couple of GitHub workflows run this tests on Linux, macOS, and Windows, and work fine. On Linux, the workflow has to install the locales for the tests to pass:
- if: runner.os == 'Linux'
name: Install Apt Packages
run: sudo apt-get install -qq language-pack-fr language-pack-en language-pack-de language-pack-it
The tests, however, fail on Windows. The warning emitted when it tries to set the locale to en-US.UTF-8 is:
perl: warning: Please check that your locale settings:
LC_ALL = "en-US.UTF-8",
(possibly more locale environment variables)
LANG = (unset)
are supported and installed on your system.
perl: warning: Falling back to the system default locale ("English_United States.1252").
I suspect that this error is not a Perl issue, since Perl, IIUC, delegates to the Windows setlocale function, which explicitly documents support for the LC_ALL environment variable and the en-US.UTF-8 format.
I had similar issues on Linux till I figured out how to apt-get install the locales, and suspect a lack of localization libraries on the GitHub Windows runner. I tried to install them with this incantation:
- if: runner.os == 'Windows'
name: Install Language Packs
run: |
Install-Language -Language en-US
Install-Language -Language fr-FR
Install-Language -Language de-DE
Install-Language -Language it-IT
But the build fails with
The term 'Install-Language' is not recognized as a name of a cmdlet, function, script file, or executable
I assume this is because Install-Language requires admin access.
So, how does one install localization languages on the GitHub Windows runner? The goal is for a workflow like this:
name: Test setlocale
on: [push]
jobs:
test:
name: Test setlocale
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: shogo82148/actions-setup-perl@v1
with: { perl-version: latest }
- run: Install-Language -Language fr-FR
- run: perl -MPOSIX -E "say POSIX::setlocale(POSIX::LC_ALL)"
env: { LC_ALL: fr_FR.UTF-8 }
to emit fr_FR.UTF-8.
I also put together this simple test case, which currently fails.