locale
The host’s system locale: LANG.
Use locale to set a host’s system locale, the LANG in its locale configuration. A host has one system locale, so a circuit needs only one locale step.
Example usage
Section titled “Example usage”Set a UTF-8 locale on Debian or Ubuntu, where Conn3x generates it if it’s missing:
step "locale" { locale { name = "en_GB.UTF-8" }}On the Red Hat family, install the locale’s language pack first:
step "langpack" { package { name = "glibc-langpack-en" }}
step "locale" { locale { name = "en_US.UTF-8" }}Arguments
Section titled “Arguments”| Name | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Locale name, such as en_US.UTF-8 or C.UTF-8. A locale that isn’t installed is generated where locale-gen exists; on the Red Hat family, add a package step for its glibc-langpack first. |
Read-only attributes
Section titled “Read-only attributes”Conn3x sets these; reference them as conn3x_locale.<circuit>__<step>["<host>"].<name>.
| Name | Type | Description |
|---|---|---|
in_sync |
bool | Whether the host has this setting. |
revision |
string | Changes each time Conn3x changes this on the host. Handlers watch it. |
A step lowers to the conn3x_locale resource, one instance per host, and connects with its circuit’s ssh block.
How it works
Section titled “How it works”Reading. On every plan, Conn3x reads LANG from /etc/default/locale where update-locale exists, as on Debian and Ubuntu, and from /etc/locale.conf elsewhere. Encodings compare the way locale -a spells them, so en_US.UTF-8 matches en_US.utf8.
Installing the locale. If locale -a doesn’t list the locale and locale-gen exists, Conn3x enables it in /etc/locale.gen and runs locale-gen. On the Red Hat family there’s no locale-gen, so the locale has to come from a glibc-langpack-<language> package; without it the step fails and names the package to install.
Applying. Conn3x runs update-locale where it exists, then localectl set-locale, and writes /etc/locale.conf itself if neither works. All three keep the setting across reboots.
Removal
Section titled “Removal”A locale step has no on_remove. When you delete it, Conn3x stops managing the locale and leaves the host as it is.