Search code examples
utf-8localefreebsd

Where is locale_gen localted on FreeBSD?


I have only two locales installed $ locale -a C POSIX

I want to use utf-8 character encoding and hence want to install en_US.UTF-8 For ubuntu I found locale_gen which does the job. Is this utility, or any similar utility present for FreeBSD? If yes, could you please tell me its location? Thanks


Solution

  • I followed this guide to install UTF-8 locale. This is how it looks like in my terminal once that's set up:

    g@crayon2:~ % locale
    LANG=en_GB.UTF-8
    LC_CTYPE="en_GB.UTF-8"
    LC_COLLATE="en_GB.UTF-8"
    LC_TIME="en_GB.UTF-8"
    LC_NUMERIC="en_GB.UTF-8"
    LC_MONETARY="en_GB.UTF-8"
    LC_MESSAGES="en_GB.UTF-8"
    LC_ALL=
    

    Copying from there this is what I changed:

    /etc/login.conf

    --- login.conf.default  2012-01-02 17:08:05.804291477 -0500
    +++ login.conf  2012-01-02 17:08:16.996213774 -0500
    @@ -44,7 +44,9 @@
        \:pseudoterminals=unlimited:\
        \:priority=0:\
        \:ignoretime@:\
    -   \:umask=022:
    +   \:umask=022:\
    +   \:charset=UTF-8:\
    +   \:lang=en_US.UTF-8:
    

    Rebuild the login database with cap_mkdb /etc/login.conf after making changes.

    /etc/profile

    LANG=en_US.UTF-8;   export LANG
    CHARSET=UTF-8;  export CHARSET
    GDM_LANG=en_US.UTF-8;   export GDM_LANG
    

    Of course I used en_GB rather than en_US as you can tell.

    Edit:

    The locale files are located in /usr/share/locale:

    g@crayon2:/usr/share/locale % ls -l
    total 1423
    drwxr-xr-x  2 root  wheel  3 11 Nov  2014 UTF-8
    drwxr-xr-x  2 root  wheel  8 11 Nov  2014 af_ZA.ISO8859-1
    drwxr-xr-x  2 root  wheel  8 11 Nov  2014 af_ZA.ISO8859-15
    drwxr-xr-x  2 root  wheel  8 11 Nov  2014 af_ZA.UTF-8
    drwxr-xr-x  2 root  wheel  8 11 Nov  2014 am_ET.UTF-8
    drwxr-xr-x  2 root  wheel  8 11 Nov  2014 be_BY.CP1131
    drwxr-xr-x  2 root  wheel  8 11 Nov  2014 be_BY.CP1251
    drwxr-xr-x  2 root  wheel  8 11 Nov  2014 be_BY.ISO8859-5
    (..)
    

    These files are not part of any port, they are part of the base.txz archive available from the FreeBSD ftp server:

    g@crayon2:~/Downloads % tar -tzf base.txz | grep "usr/share/locale"
    ./usr/share/locale/
    ./usr/share/locale/lt_LT.ISO8859-4/
    ./usr/share/locale/en_GB.ISO8859-15/
    ./usr/share/locale/kk_KZ.PT154/
    ./usr/share/locale/it_IT.ISO8859-15/
    ./usr/share/locale/hy_AM.UTF-8/
    ./usr/share/locale/en_IE.UTF-8/
    ./usr/share/locale/zh_HK.UTF-8/
    ./usr/share/locale/en_AU.ISO8859-1/
    ./usr/share/locale/zh_CN.eucCN/
    ./usr/share/locale/fr_BE.ISO8859-15/
    ./usr/share/locale/en_AU.UTF-8/
    (...)