Language in FreeBSD

Polytropon freebsd at edvax.de
Mon Jun 16 00:35:30 UTC 2014


On Mon, 16 Jun 2014 02:09:26 +0200, ddddd dddd wrote:
> Hello. I am trying to change FreeBSD to Norwegian. Setting :lang
> in ~/.login_conf didn't work.

How exactly did you do that?

Programs usually support the LC_* variables (LC_MESSAGES for
example, LC_ALL to override) as well as LANG. You can try to
set those in your ~/.login if the C shell is your login shell,
or in ~/.login_conf, for example like this:

	me:\
		:charset=iso-8859-1:\
		:lang=de_DE.ISO8859-1:

Note that you probably will use UTF-8 instead of ISO-8859-1
if you want to be "future-proof". :-)



> Also, I don't know how much of FreeBSD is actually translated,
> if any.

The system messages and manpages are usually provided in English,
but the documentation (Handbook and FAQ) offer many language
variants. There basically is no real need for localized system
messages because those who "use" them will have no problem with
the fact that they are in English, and it also makes them more
"portable", especially within communication such as mailing lists
or web forums. Still especially many X programs obey language
settings and in case their authors have implemented localization
support, text elements will be shown in the language requested.



> So if I can't get that to work, getting Norwegian letters
> working will be enough.

For the console, you need to set those in /etc/rc.conf (but in
your case for Norwegian - I'm just providing the text from my
working German setup):

	keymap="german.iso"
	keyrate="fast"
	font8x14="iso-8x14"
	font8x16="iso-8x16"
	font8x8="iso-8x8"

For X, you need to either have /etc/X11/xorg.conf with the
required settings, like this:

	Section "InputDevice"
		Identifier	"Keyboard0"
		Driver		"kbd"
		Option		"XkbModel"	"pc105"
		Option		"XkbLayout"	"de"
		Option		"XkbOptions"	"terminate:ctrl_alt_bksp"
	EndSection

Or you have to fiddle with XML files scattered across the /usr/local
subtree in case you're using HAL, as explained here (Handbook 6.2.4):

https://www.freebsd.org/doc/handbook/x-config.html

It could look like this:

	<?xml version="1.0" encoding="ISO-8859-1"?>
	<deviceinfo version="0.2">
	  <device>
	    <match key="info.capabilities" contains="input.keyboard">
	      <merge key="input.x11_driver" type="string">kbd</merge>
	      <merge key="input.xkb.layout" type="string">de</merge>
	      <merge key="input.xkb.variant" type="string">nodeadkeys</merge>
	    </match>
	  </device>
	</deviceinfo>

Here's some more information:

https://www.freebsd.org/doc/handbook/using-localization.html

https://www.freebsd.org/doc/handbook/lang-setup.html



> When I installed, I selected Norwegian ISO keyboard map, Norwegian
> with code page 850 weren't available.

Try not to use a CP setting, check if you can use UTF-8 or the
ISO-8859 version corresponding to your location. If it's western
europe, try ISO-8859-1 or ISO-8859-15.



> However the extra Norwegian letters aren't working in csh, sh or
> vi, they show up as "\330" or something similar, at least in
> csh (I could give all details of how each program handle the
> keys if that will help).

You probably did not load a _font_ which supports displaying those
characters.



> -I can't use combining accents, when I write "´" , it is shown
> immediately and I can't combine it with letters.

I think this is typical for the console, but should work in X
("dead keys").



> Neither of these two problems are there when running ee in xterm,
> but xterm still has the identical problem with csh, sh and vi not
> accepting the extra letters. Also, the Euro sign is not working
> in ttyv or xterm. I have none problem at all in Firefox, both the
> letters and Euro sign is working.

Maybe you can add some C shell specific environmental settings.
Here are some examples:

	# german input, english messages
	setenv	LC_ALL		en_US.ISO8859-1
	setenv	LC_MESSAGES	en_US.ISO8859-1
	setenv	LC_COLLATE	de_DE.ISO8859-1
	setenv	LC_CTYPE	de_DE.ISO8859-1
	setenv	LC_MONETARY	de_DE.ISO8859-1
	setenv	LC_NUMERIC	de_DE.ISO8859-1
	setenv	LC_TIME		de_DE.ISO8859-1
	unsetenv LANG

	# german with Euro sign
	setenv	LC_ALL		de_DE.ISO8859-15
	setenv	LC_COLLATE	de_DE.ISO8859-15
	setenv	LC_CTYPE	de_DE.ISO8859-15
	setenv	LC_MESSAGES	de_DE.ISO8859-15
	setenv	LC_MONETARY	de_DE.ISO8859-15
	setenv	LC_NUMERIC	de_DE.ISO8859-15
	setenv	LC_TIME		de_DE.ISO8859-15

	# german with UTF-8 ("more international")
	setenv	LC_ALL		en_US.UTF-8
	setenv	LC_MESSAGES	en_US.UTF-8
	setenv	LC_COLLATE	de_DE.UTF-8
	setenv	LC_CTYPE	de_DE.UTF-8
	setenv	LC_MONETARY	de_DE.UTF-8
	setenv	LC_NUMERIC	de_DE.UTF-8
	setenv	LC_TIME		de_DE.UTF-8
	setenv	LANG		de_DE.UTF-8

Maybe this this can help with testing and inspiration. :-)




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list