# Create a new locale on FreeBSD



## 0mp (Nov 4, 2019)

I'd like to create a new locale on FreeBSD. I thought that I can just copy one of the existing ones in `/usr/share/locale` but apparently it is not so simple.

Firstly, I just create a copy of the en_US.UTF-8 locale.



```
$ sudo cp /usr/share/locale/en_US.UTF-8 /usr/share/locale/en_DK.UTF-8
```


I am testing my setup with Mosh, so with the standard en_US.UTF-8 everything is fine:


```
$ LC_ALL=en_US.UTF-8 PATH_LOCALE=/usr/share/locale mosh xyz.example.org
```


However, if I try to use the newly created en_DK.UTF-8 locale I get the following errors:


```
$ LC_ALL=en_DK.UTF-8 PATH_LOCALE=/usr/share/locale mosh xyz.example.org
The locale requested by LC_ALL=en_DK.UTF-8 isn't available here.
Running `locale-gen en_DK.UTF-8' may be necessary.

mosh-server needs a UTF-8 native locale to run.

Unfortunately, the local environment ([no charset variables]) specifies
the character set "US-ASCII",

The client-supplied environment (LC_ALL=en_DK.UTF-8) specifies
the character set "US-ASCII".

sh: warning: setlocale: LC_ALL: cannot change locale (en_DK.UTF-8)
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_DK.UTF-8
LC_CTYPE="en_DK.UTF-8"
LC_NUMERIC="en_DK.UTF-8"
LC_TIME="en_DK.UTF-8"
LC_COLLATE="en_DK.UTF-8"
LC_MONETARY="en_DK.UTF-8"
LC_MESSAGES="en_DK.UTF-8"
LC_PAPER="en_DK.UTF-8"
LC_NAME="en_DK.UTF-8"
LC_ADDRESS="en_DK.UTF-8"
LC_TELEPHONE="en_DK.UTF-8"
LC_MEASUREMENT="en_DK.UTF-8"
LC_IDENTIFICATION="en_DK.UTF-8"
LC_ALL=en_DK.UTF-8
Connection to xyz.example.org closed.
/usr/local/bin/mosh: Did not find mosh server startup message. (Have you installed mosh on your server?)
```

PS: The motivation for this is to make the misc/locale-en_DK work more reliably.


----------

