mikaela.github.io/n/localectl.md

133 lines
4.9 KiB
Markdown
Raw Normal View History

2016-10-16 19:51:04 +02:00
---
title: Quick localectl config
2024-06-19 07:19:44 +02:00
excerpt:
Reminder on systemd keyboard and language settings, also including more
regionally tailored ones.
2024-05-18 18:58:57 +02:00
layout: mini
permalink: /n/localectl.html
2016-10-16 20:07:23 +02:00
redirect_from:
- /locale.html
- /locales.html
2018-11-25 23:51:24 +01:00
- /english/2016/10/16/adjusting-locales.html
- /blog/english/2016/10/16/adjusting-locales.html
sitemap: true
2024-05-30 08:05:52 +02:00
lang: en
robots: noai
2016-10-16 19:51:04 +02:00
---
# Quick notes on `localectl` settings
_{page.excerpt}_
<!-- editorconfig-checker-disable -->
<!-- prettier-ignore-start -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
2024-05-30 08:05:52 +02:00
<em lang="fi">Automaattinen sisällysluettelo</em> / <em lang="en">Automatically generated Table of Contents</em>
- [Ready commands](#ready-commands)
- [Finland compatible internationalish English](#finland-compatible-internationalish-english)
- [Explanations](#explanations)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- prettier-ignore-end -->
<!-- editorconfig-checker-enable -->
## Ready commands
TL;DR:
```
sudo localectl set-keymap fi
sudo localectl set-locale fi_FI.UTF-8
sudo localectl set-x11-locale fi
```
### Finland compatible internationalish English
2016-10-16 19:51:04 +02:00
```bash
sudo localectl set-locale LANG=en_IE.UTF-8 LC_TIME=en_DK.UTF-8 LC_MONETARY=fi_FI.UTF-8 LC_NAME=fi_FI.UTF-8 LC_TELEPHONE=fi_FI.UTF-8
```
2016-10-16 19:51:04 +02:00
2024-06-19 07:19:44 +02:00
- Everything will be in English, but time will be in ISO 8601, financial units
use Finnish separators, names are sorted according to Finnish alphabet (a, …,
x, y, z, å, ä, ö) and phone numbers begin with the Finnish `+358` prefix.
## Explanations
2024-06-19 07:19:44 +02:00
- LANG is the language and defaults for other variables if they are unset. en_DK
gives ISO 8601 date format for everything respecting LC_TIME.
- `LANG=en_IE date` returns `Sun 02 Jun 2024 11:05:04 EEST`, while
`LANG=en_DK date` returns `2024-06-02T11:05:04 EEST`.
- LC_MONETARY sets the currency and how sums of it are managed.
2024-06-19 07:19:44 +02:00
- LC_NAME sets name format and I prefer Finnish (just the name) to Irish which
probably has `M{r,s,rs}` and I hate them being gendered and I doubt it
understands Mx.
2024-06-19 07:19:44 +02:00
- LC_TELEPHONE sets telephone number format and I set it to fi_FI as it defaults
international numbers to +358 and I am more likely to be typing Finnish
numbers than Irish. I imagine it can affect office tools, and it's here more
of just in case.
2016-10-16 19:51:04 +02:00
And naturally to use these locales, they must be compiled.
So `/etc/locale.gen` must include the lines
```
en_DK.UTF-8 UTF-8
en_IE.UTF-8 UTF-8
2016-10-16 19:51:04 +02:00
fi_FI.UTF-8 UTF-8
```
and as always, after editing that file, you must run `sudo locale-gen`.
2024-06-19 07:19:44 +02:00
(Debian & deriative users, you have `dpkg-reconfigure locales` that merges the
editing and locale-gen and that is probably what you are supposed to use.)
2016-10-16 19:51:04 +02:00
2024-06-19 07:19:44 +02:00
It seems like I didn't even say anything about that UTF-8 part, but it's 2024
and everything is UTF-8 (or your things are horribly broken and the rest of the
world hates you).
2016-10-16 19:51:04 +02:00
Sources/thanks:
2023-02-22 19:28:38 +01:00
- [Arch Wiki: Locale, LC_TIME](https://wiki.archlinux.org/index.php/locale#LC_TIME:_date_and_time_format)
- [Locale Helper: en_IE](https://lh.2xlibre.net/locale/en_IE/)
- [Locale Helper: fi_FI](https://lh.2xlibre.net/locale/fi_FI/)
2023-02-22 19:28:38 +01:00
- [Wikipedia: UTF-8](https://en.wikipedia.org/wiki/UTF-8)
2024-06-19 07:19:44 +02:00
- Random misplaced advice: disable charset fallback in your IRC client and be
UTF-8 only! You will see when someone is not using UTF-8 and won't submit
useless bug reports to bots/bridges/whatever that are UTF-8 only (as
supporting every charset is impossible, since IRC has nothing to declare
character set, and there is zero reason why you wouln't be using UTF-8! Well
nowadays some have
[IRCv3 `UTF8ONLY` `ISUPPORT` token](https://ircv3.net/specs/extensions/utf8-only)).
2023-02-22 19:28:38 +01:00
- [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
2024-06-19 07:19:44 +02:00
- You should read it or at least be aware of it especially if you are in
contact with people from other countries and even more if you are in
international communities trying to get anything done with anything that has
to do with time or date!
2019-12-27 13:14:22 +01:00
2023-02-22 19:28:38 +01:00
---
2019-12-27 13:14:22 +01:00
2024-06-19 07:19:44 +02:00
2019-12-27: I don't see LANGUAGE mentioned here, but it was blocking me from
changing language of GNOME and `sudo dpkg-reconfigure locales` in the end gave
me
`*** update-locale: Warning: LANGUAGE (en_US:en) is not compatible with LANG (fi_FI.UTF-8). Disabling it.`.
2019-12-27 13:14:22 +01:00
Either I was wrong on it being list of fallback languages I wish to use, or
2024-06-19 07:19:44 +02:00
GNOME has different view on it, but as I think I have seen errors related to it
before, I will drop `LANGUAGE` from the variables I set.
---
2024-06-19 07:19:44 +02:00
2024-04-04: `export LANGUAGE=eo:fi:en` in a file read by my
[`zshrc`](https://gitea.blesmrt.net/mikaela/shell-things/src/branch/master/rc/zshrc)
works fine as it gets read before my
[`startsway`](https://gitea.blesmrt.net/mikaela/scripts/src/branch/master/bash/usr-local-bin/startsway)
anyway.
---
2024-06-02: fixed a lot of language, practically rewrote the page.