1

To demonstrate locale support in Ubuntu:

vagrant init ubuntu/jammy64
vagrant up
vagrant ssh
sudo apt-get -y install hello language-pack-nb
LC_MESSAGES=nb_NO.UTF-8 hello

This prints the expected, localised "Hei, verden!" message.

Let's try running the Nix package instead, following the only locale hint I could find:

sudo apt-get -y purge hello
yes | sh <(curl -L https://nixos.org/nix/install) --daemon
exit
vagrant ssh
nix-shell --packages hello
export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
LC_MESSAGES=nb_NO.UTF-8 hello

This instead prints "Hello, world!". I also tried to sudo dpkg-reconfigure locales and set "nb_NO.UTF-8" as the default locale, but no go.

What do I need to do now to get the localised message inside the Nix shell?

1 Answer 1

1

First, I had to reconfigure locales in Ubuntu, adding the relevant locale to the configuration.

Second, even though the localisation of the package is in a directory called share/locale/nb/LC_MESSAGES, it was not enough to set LC_MESSAGES=nb_NO.UTF-8. I had to instead set LANG=nb_NO.UTF-8.

In other words, this seems to be the minimum steps:

sudo dpkg-reconfigure locales
nix-shell -p hello
export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive
LANG=nb_NO.UTF-8 hello

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .