Xfce locale in Xfce

Hi guys,

I have just installed slim with xfce and all is okay but the typing language is wrong (though it's correct in vt). I tried to change the language in login.conf and /etc/profile and all it does is it changes the environment language but not the typing language. I'm running the default shell.

How do I configure Xfce to use Norwegian (nb_NO) with UTF8 and if I wanted to change to the bash shell, what would then needed to be done to change the language/locale?

I understand that for X, .xinitrc should be edited but I don't know how. I have copied the default xinitrc from Xfce and linked .xsession to it.

Thanks.
 
There are several shells that might be used in FreeBSD. csh(1) (which is really tcsh(1)) is the default for root, and settings are typically changed in ~/.cshrc. Be aware that it uses a different syntax than sh(1). Also be aware that sh(1) in FreeBSD really is sh(1), not bash.

First, please do not change the default shell for root. There's a story behind that, but it can be discussed elsewhere. Changing a user's shell can be done with chsh(1) or the old-school method, vipw(8).

There is a section in the Handbook on locale settings that might help: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/using-localization.html.
 
Thanks wblock@, I was not thinking of changing anything for root. There's ([or That's? -- mod.] another user on the system. I have had look at the handbook but will check it thoroughly.
 
Last edited by a moderator:
There are (I feel) a gazillion ways to change the keyboard language/layout. An often chosen way that seems logical is to edit one's shell's startup configuration (which for bash is ~/.bashrc).

A probably better way is to edit /etc/login.conf because it's independent of the shell used. You might want to change the last part of the :default section from ":umask=022:" to
Code:
        :umask=022:\
        :charset=UTF-8:\
        :lang=no_NO.UTF-8:
(Note: Don't trust me on that no_NO.UTF-8! I just guessed it. Possibly the correct string for Norwegian is different but I guess that you know the correct one.)

As for X many think that xorg.conf is the right way. I disagree. Because it quite sometimes doesn't work and because xorg.conf actually may well open a can of worms. My suggestion is to edit ~/.xinitrc and to change or add some lines like so:
Code:
export LANG="no_NO.UTF-8"
export LC_ALL="no_NO.UTF-8"
setxkbmap -model  pc105 -layout "no"  -option "grp:alt_shift_toggle,terminate:ctrl_alt_bksp" &
 
Hi,

I've read the Handbook, it does not say much about X and locale configuration. It should be updated. The only thing I understood is that it's recommended to edit .login_conf or login.conf which is for vt and terminals.

I searched the web for suggestions and found that it could be done by creating a *.fdi file and that indeed helped but essential characters are not correct.

About Xorg.conf, there isn't one on my system as I haven't run Xorg -configure. I had linked .xsession to .xinitrc (from the Xfce default) but don't have any idea where to put the lines.

Another weird bug or what should I call it, is that the poweroff/reboot buttons in Xfce don't behave. Sometimes the possibility to suspend, hibernate, shutdown and restart are there and another time they're not (after reboot, logoff). After another reboot the buttons are back again. Go figure. Is there a way to fix it such that all the buttons are there all the time?

Have some questions about wireless (does not activate at boot (just tries and tries) too, but that is for another thread.

Edit: Running 10.1 with slim and Xfce.

Regards.
 
Last edited by a moderator:
I was sure rmoe answered here earlier today. Have I woken the devil?! Sorry to bother you Lord Evil :)

Anyway I have respect and admiration for your work. It was a hint on constructive criticism; no more, no less. If there are a "gazillion" ways of configuring something, why wouldn't the handbook contain a couple of them? But maybe I'm all wrong, maybe FreeBSD is not supposed to handle X (or is intended to), what would I know.

My reason of not going into details of what I have done with .fdi is simple, I'm not on the "problem"-system right now and cannot remember the solution as my experience with FreeBSD is two weeks "playing a little" in total.

I just found it again on the net: /usr/local/etc/hal/fdi/policy/x11-input.fdi:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.keyboard">
      <merge key="input.x11_options.XkbLayout" type="string">gb</merge>
    </match>
  </device>
</deviceinfo>
That's what I did and it got the right keyboard but as I stated earlier, no right Norwegian letters. Yes, this is only in X (Xfce). Yup, would think that's one of the "gazillion" ways of doing it. :)

So does anyone know where .xinitrc needs to be edited to load the right keyboard-mapping/locale (but not the system language)?

Thanks in advance to the community!
 
Last edited by a moderator:
I have the same problem.

Have you found a solution for Norwegian keyboard in tty, and in xfce, question mark.
 
Recently there were posts that were suggesting that one is better off when there is no xorg.conf. While this might be true for those needing no international keyboard layout, I found no other way to define a non en_ keyboard layout in Xorg other than creating a xorg.conf with appropriate entries.
 
Perfect, then just add this to your ~/.xsession and/or ~/.xinitrc. The UTF version has been proposed by rmoe in post#4. It might be a good idea to think about using UTF-8 anyhow.
 
I have had the same issue with Umlaute. Finally I have configured almost similar as in the post#4. Please see the extracts below. I have deleted some additional lines.
Code:
grep -i utf /etc/login.conf
  :charset=UTF-8:\
  :lang=de_DE.UTF-8:\
Code:
cat /home/chris/.xsession
setxkbmap -layout de
jwm
The advantage with UTF-8 is that you might have less issues when you exchange data by mail or so with other people.
 
Xfce uses the GNU gettext library for internationalization (i18n). So if you define these two environment variables ( LANG, and LC_CTYPE) in .xinitrc, the desktop should display messages in your locale.

To view all locale -a ( grep to display only locale, you want).

teo

Code:
locale -a | grep es
es_ES.ISO8859-1
es_ES.ISO8859-15
es_ES.UTF-8

.xinitrc will look like

Code:
#!/bin/sh

export LANG="es_ES.UTF-8"
export LC_CTYPE="es_ES.UTF-8"
[...]

About keyboard layout, it's Xorg which handles it (see this howto). Currently Xorg manages only one layout, if you need to switch another, try deskutils/xfce4-xkb-plugin.

If you need to redefine some keys, .xinitrc reads .Xmodmap. Myself I use this file for multimedia keys, and Ctrl right (which doesn't work otherwise).
 
I could put it harshly confessing that I was stupid or I could put it nicely saying that we all continue to learn and so do I. Pick your choice ;)

So, my advice above was a little suboptimal in that putting the stuff into the default section of /etc/login.conf sounds simple and logical but can (sometimes) actually create trouble.

The correct way is to create a locale specific section like the "Russian" example in /etc/login.conf . To do even better do *not* set everything to (your country).UTF-8 because quite some software and ports building gets confused when collation is not "C".

So to demonstrate a France/french setting as example it should look like
Code:
french|French Users Accounts:\
        :charset=UTF-8:\
        :lang=fr_FR.UTF-8:\
        :setenv=LC_TIME=fr_FR.UTF-8:\
        :setenv=LC_NUMERIC=fr_FR.UTF-8:\
        :setenv=LC_MONETARY=fr_FR.UTF-8:\
        :setenv=LC_COLLATE=C:\
        :tc=default:
Hint: You might want to do the same for root.

(don't forget cap_mkdb!)

Finally set your french user to login class "french" (or whatever - the identifier from the first line above) either when creating them (you are asked for the login class when creating users) or using pw usermod jean -L french for an existing user (using user "jean" and "french" login class as example).
 
I install latest x11/xorg, x11/slim and x11/xfce4 from Ports by ports-mgmt/poudriere.
I use zh_TW.UTF-8 locate in x11/xfce4.
Thank you for maintainer of x11/slim, now it loads /etc/login.conf.

Keyboard configuration to the latest 'DEVD-aware x11/xorg:
# su root
# mkdir -p /etc/X11/xorg.conf.d
# vi /etc/X11/xorg.conf.d/90-input.conf


My /etc/X11/xorg.conf.d/90-input.conf file, you may change keyboard layout in the line of Option "XkbLayout":
Code:
Section "InputClass"
  Identifier  "FreeBSD DEVD kbdmux interface"
  MatchIsKeyboard  "on"
  MatchDevicePath  "/dev/kbdmux*"
  Driver  "keyboard"
  Option  "Protocol"  "standard"
  Option  "XkbRules"  "base"
  Option  "XkbLayout" "us"
  Option  "XkbModel"  "pc105"
EndSection
Add charset and lang values in your login class (usually is default class) in /etc/login.conf:
Code:
default:\
  ....
  ....
  :charset=UTF-8:\
  :lang=zh_TW.UTF-8:\
  ....
  ....
After editing /etc/login.conf, don't forget the following commands:
# su root
% cd /etc
% cap_mkdb /etc/login.conf
 
Back
Top