You are not logged in.

#1 2024-08-08 03:56:34

avidseeker
Member
Registered: 2022-09-06
Posts: 62
Website

Preview locales

How do I quickly preview what a locale looks like? E.g: is there something like

$ localepreview en_DK.UTF-8

Of course, I can easily write a script like

#!/bin/bash
LOCALE=$1

export LANG=$LOCALE
export LC_TIME=$LOCALE
export LC_NUMERIC=$LOCALE
export LC_MONETARY=$LOCALE

echo "Date and Time (locale: $LOCALE):"
date
echo

echo "Numeric Formatting:"
printf "Number: %'.2f\n" 1234567.89

But what about the other variables? Is there a convenient file there in the system that give such examples? Something like

$ less /usr/share/iso-codes/json/iso_3166-1.json

Offline

#2 2024-08-08 09:45:02

bonbon12
Member
Registered: 2024-08-08
Posts: 7

Re: Preview locales

export LANG=en_DK.UTF-8
locale

For locale information files similar to your iso-codes example, you can find locale data in /usr/share/locale/, for example:

less /usr/share/locale/en_DK.UTF-8/LC_TIME


Have a great day smile

Create website designs

Offline

#3 2024-08-08 15:19:34

seth
Member
Registered: 2012-09-03
Posts: 58,004

Re: Preview locales

/usr/share/locale/en_DK.UTF-8/LC_TIME shoudl be a directory?

https://man.archlinux.org/man/core/man-pages/locale.5.en
locale -k LC_NAME # eg.

Idk whether there's a nice script of code to demonstrate the various locales w/ dummies, sorry.

Offline

Board footer

Powered by FluxBB