How to change DATE command output language locales in Alpine-Linux?

Hello,

I have little experience in the linux environment and for the last few days I’ve been trying to bring an old netbook back to life. And to make this difficult task possible, I’m using Alpine-Linux.
I got a lot of progress installing XFCE4 and the translations of GUI elements to pt_BR. Although the application that manages the calendar is correctly translated to pt_BR, the system DATE is still being displayed in en_US.

Device: aspireone-532h
OS Name: Alpine Linux v3.17
Xfce Type: 4.16
Distributor: Alpine Linux
CPU: Intel Aton CPU N450 @ 1.66GHz x 2
Memory: 1.9 GiB
GPU: i915 (384.0 MiB)

In the terminal when I use the [date] command it returns the date in en_US.

aspireone-532h:/# date
Wed Dec 21 16:50:31 -02 2022

I need to change the output to the pt_BR language. Thanks in advance if anyone has any information in this regard.

The procedure to enable Portuguese - BRAZIL (BR) (pt_BR) under Alpine Linux is as follows:

  1. Install Locales support for musl using the apk command:
apk add musl-locales 
apk add lang # pull lang packages for existing installed pkgs
  1. List all locales installed. For example:
locale -a 
locale -a | more
locale -a | grep -i BR
  1. Set MUSL_LOCPATH using the export command:
export MUSL_LOCPATH=/usr/share/i18n/locales/musl
  1. Test it using the date command:
LC_ALL=fr_FR.UTF-8 date
LC_ALL=pt_BR.UTF-8 date
  1. Add the following to your shell profile file such as $HOME/.profile or $HOME/.bash_profile
export MUSL_LOCPATH=/usr/share/i18n/locales/musl
export CHARSET=pt_BR.UTF-8
export LANG=pt_BR.UTF-8
export LC_COLLATE=pt_BR.UTF-8
date

Hi, it worked perfectly!

aspireone-532h:~# date
qua dez 21 22:52:20 -02 2022

Thank you very much! :smiley:

Good to know. I marked it as solved.