# Turkish keys act weirdly on some x applications.



## agoodfella (Feb 23, 2021)

Hello there, im using a turkish keyboard. i used setxkbmap to change my layout however whenever i use the keys ışğçö some x applications give me random numbers such as alacritty. However some other things like firefox accepts the input. can you help me out.


----------



## T-Daemon (Feb 24, 2021)

Running x11/alacritty with UTF-8 set to the login shell and "tr" set to X11 conf:






/etc/login.conf


```
default:\
            ...
            :umask=022:\
            :charset=UTF-8:\
            :lang=C.UTF-8:
```
login.conf(5)

After editing /etc/login.conf it is requiered to run `cap_mkdb /etc/login.conf` to update the login class capability database, and log out / log in for any logged in user to take effect. Replace `lang` with `tr_TR.UTF-8` if desired.

/usr/local/etc/X11/xorg.conf.d/keyboard.conf


```
Section "InputClass"
        Identifier      "All Keyboards"
        MatchIsKeyboard "yes"
        Option          "XkbLayout" "us, tr"
        Option          "XkbOptions" "grp:ctrls_toggle"
EndSection
```
xkeyboard-config(7)


----------



## agoodfella (Feb 24, 2021)

I couldn't make it work, here is my /etc/login.conf and /usr/local/etc/X11/xorg.conf.d/keyboard.conf files, please enlighten me about what i did wrong.


----------



## SirDice (Feb 24, 2021)

Post the text please, not pictures. They're impossible to quote.


----------



## eternal_noob (Feb 24, 2021)

My .login_conf has languages set in the `setenv` parameter:

Note: i use german layout (de_DE.UTF-8) but you can easily change this to turkish

```
me:\
    :charset=UTF-8:\
    :setenv=LC_ALL=de_DE.UTF-8,LC_COLLATE=de_DE.UTF-8,LC_CTYPE=de_DE.UTF-8,LC_MESSAGES=de_DE.UTF-8,LC_MONETARY=de_DE.UTF-8,LC_NUMERIC=de_DE.UTF-8,LC_TIME=de_DE.UTF-8:\
    :lang=de_DE.UTF-8:
```

In .xinitrc i have this:
`setxkbmap de -variant nodeadkeys -model pc105`

No Xorg config files regarding language.


----------



## T-Daemon (Feb 24, 2021)

agoodfella said:


> ... what i did wrong.



At the line end of `:umask=022:` a backslash (\) is missing. Don't forget to run `cap_mkdb /etc/login.conf`, and to log out and log in. "us" in keybord.conf is not a requirement, I added "tr"o my configuration.


----------



## eternal_noob (Feb 24, 2021)

T-Daemon said:


> At the line end of `:umask=022:` a backslash (\) is missing.


Nice find.


----------



## T-Daemon (Feb 24, 2021)

freebsd_noob said:


> i use german layout (de_DE.UTF-8)





freebsd_noob said:


> :setenv=LC_ALL=de_DE.UTF-8


The variable LC_ALL is superseding all other LC_* variables, no need to set them seperately. I get back to you with a doc source.


----------



## eternal_noob (Feb 24, 2021)

T-Daemon said:


> The varible LC_ALL is superseding all other LC_* variables, no need to set them seperately.


I thought this was the case but the handbook sets them all: https://docs.freebsd.org/en/books/handbook/using-localization.html


----------



## T-Daemon (Feb 24, 2021)

T-Daemon said:


> I get back to you with a doc


Not what I was looking for, but it's good too:




__





						Understanding locale environment variables
					

Multicultural support uses several environment variables to influence the selection of locales. You can set the values of these variables to change search paths for locale information:



					www.ibm.com


----------



## T-Daemon (Feb 24, 2021)

freebsd_noob said:


> I thought this was the case but the handbook sets them all: https://docs.freebsd.org/en/books/handbook/using-localization.html


That example is incorrect. If LC_ALL is set the following LC_* variables are ignored. Somebody should file a bug report with a patch to correct the mistake.


----------



## eternal_noob (Feb 24, 2021)

I can confirm that `LC_ALL` alone works like a charm.


----------



## agoodfella (Feb 24, 2021)

T-Daemon said:


> At the line end of `:umask=022:` a backslash (\) is missing. Don't forget to run `cap_mkdb /etc/login.conf`, and to log out and log in. "us" in keybord.conf is not a requirement, I added "tr"o my configuration.


Yep that fixed it. sadly now all my system become turkish not just keyboard. Is there a way to keep the system language english?


----------



## Snurg (Feb 24, 2021)

agoodfella said:


> Is there a way to keep the system language english?


This is an issue that bothers me, too.
For some reasons when I tried to get german keyboard layout, I always got german system language, too, even when avoiding setting LC_ALL, LC_MESSAGES etc.
My guess is that some other things might be somehow derived from the keyboard setting, maybe NLSPATH or the like.

Using an US-International variant avoids this problem, and allows plenty of accents being used (pressing accent key, then the accented key results in all possible variants of the according latin key used over the world).
But this is not a solution for everybody, so I too would appreciate if there is a clean solution to avoid getting a language mix as "system language"...


----------



## SirDice (Feb 24, 2021)

agoodfella said:


> sadly now all my system become turkish not just keyboard.


LANG sets the language. Leave that on en_US.UTF-8.


----------



## T-Daemon (Feb 24, 2021)

agoodfella said:


> Yep that fixed it. sadly now all my system become turkish not just keyboard. Is there a way to keep the system language english?


Besides what SirDice suggested setting to `:lang=C.UTF-8:` will keep the locale to US.


----------



## T-Daemon (Feb 24, 2021)

Snurg said:


> For some reasons when I tried to get german keyboard layout, I always got german system language, too, even when avoiding setting LC_ALL, LC_MESSAGES etc.


I have the /etc/login.conf set as im my posting #1, and `keymap="de.acc"` in /etc/rc.conf , nothing else (I'm using on my systems german keyboard layout). System locale is US , german specific ü, ö, ä, ß keys are printed.


----------



## agoodfella (Feb 24, 2021)

T-Daemon said:


> Besides what SirDice suggested setting to `:lang=C.UTF-8:` will keep the locale to US.


That solved the final problem. Case solved.


----------

