如何在FreeBSD上生成其他语言环境?

时间:2016-03-03 08:10:16

标签: utf-8 locale freebsd

我只安装了两个语言环境 $ locale -a C POSIX

我想使用utf-8字符编码,因此想要安装en_US.UTF-8 对于ubuntu,我找到了locale_gen来完成这项工作。这个实用程序,或任何类似的实用程序是否为FreeBSD提供?如果是的话,你能告诉我它的位置吗?

1 个答案:

答案 0 :(得分:3)

我遵循了guide to install UTF-8 locale。这就是我的终端设置后的样子:

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=

从那里复制这是我改变了:

/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:

在进行更改后,使用cap_mkdb /etc/login.conf重建登录数据库。

/etc/profile

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

当然,我使用的是en_GB而不是en_US

修改

语言环境文件位于/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
(..)

这些文件不属于任何端口,它们是FreeBSD ftp server提供的base.txz存档的一部分:

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/
(...)