Localize Manjaro

Locale and Keyboard Layouts

The locale is all the settings related to localization, like GUI/applications language, time, currency etc. In Manjaro you can set the preferred locale settings using Manjaro Settings Manager GUI application. Sometimes, because of complicated setups and often after some user mistakes, you might not be able to have the correct settings for each user. Below you will see how you can check and set properly your configuration manually.
Keyboard layouts are treated separately from the locale configuration and are divided in GUI (Xorg) and Console, although they are controlled by one utility, localectl(in systemd installations).

In Linux systems all locales are available for installation, they just need to be enabled and generated. The settings are configured initially system-wide, but it is possible to override them per user-session.

System

Check your current system settings (type in terminal)

 locale

Check which are already active

 locale -a

Example output : LANG=zh_TW.UTF-8
If your locale is not listed, you must edit /etc/locale.gen and uncomment yours.

# zh_SG.UTF-8 UTF-8
# zh_TW BIG5
# zh_TW.EUC-TW EUC-TW
zh_TW.UTF-8 UTF-8
# zu_ZA ISO-8859-1

You may want to uncomment all the variations of your country code “zh_TW” to use them as fallbacks for some programs they might use them. Then, generate them with this command

sudo locale-gen

Now you can set the system locale with this

sudo localectl set-locale LANG=zh_TW.UTF-8

The settings are set in the system file /etc/locale.conf. You don’t need to manually edit this file unless you are having troubles. Here is a sample

 LANG=zh_TW.UTF-8
 LANGUAGE=zh_TW:en_AU
 LC_ADDRESS=en_AU.UTF-8
 LC_IDENTIFICATION=en_AU.UTF-8
 LC_MEASUREMENT=en_AU.UTF-8
 LC_MONETARY=en_AU.UTF-8
 LC_MESSAGES=zh_TW.UTF-8
 LC_NAME=en_AU.UTF-8
 LC_NUMERIC=en_AU.UTF-8
 LC_PAPER=en_AU.UTF-8
 LC_TELEPHONE=en_AU.UTF-8
 LC_TIME=en_AU.UTF-8

User

The system locale can be overriden for a user that wants a different locale language by creating (or editing if it already exists) a file named .xprofile in the home folder /home/USERNAME/.xprofile. Edit it with any user specific locale settings as bellow. This sample illustrates how to set Traditional Chinese as the UI language while keeping Australian English for the formats.

# Set display language to zh_TW and gcin as default IM
export LANG=zh_TW.UTF-8
export LANGUAGE=zh_TW:en_AU
export LC_MESSAGES=zh_TW.UTF-8
export LC_CTYPE=zh_TW.UTF-8
export XMODIFIERS=@im=gcin
export GTK_IM_MODULE=gcin
export QT_IM_MODULE=gcin
export XIM_MODULE=gcin

Console fonts

The file /etc/vconsole.conf holds information on your keyboard layout and the font displayed in the TTY - the physical console.

Here is a sample setup for danish keyboard and font.

KEYMAP=dk
FONT=ter-118n

Non-English Keyboard Layouts

If you are using non-default settings or non-English layout for your Keyboard, use this command without sudo, changing to your preferred layouts (check here)

localectl --no-convert set-x11-keymap us,gr pc105 , grp:alt_shift_toggle

The above example is for English-Greek standard layouts, with Alt+Shift swithing. For selecting your options use the below commands

localectl list-x11-keymap-models, list-x11-keymap-layouts,  \
          list-x11-keymap-variants [LAYOUT], list-x11-keymap-options

[Man-page] List available X11 keymap models, layouts, variants and options, useful for configuration with set-keymap. The command list-x11-keymap-variants optionally takes a layout parameter to limit the output to the variants suitable for the specific
layout.

Permanent user settings

A problem may happen with Suspend/Sleep (depending your session/DE), because during sleep, X stops and starts on wake up again. To avoid such issues, it may help to make the settings permanent for your user account, by adding that command in your home folder ~/.xinitrc (or ~/.xprofile).
In a real multi-user system with several user locales, this should be applied at /etc/skel/.xinitrc (or .xprofile), so that every new user has individual session settings.
In systems where these settings are the same for all accounts, it is sufficient to run the localectl command once, which writes the settings in /etc/X11/xorg.conf.d/00-keyboard.conf


Other Considerations (i.e. DM, DE…)

Manjaro Settings Manager (MSM)

MSM has a Language (Locale Settings) configuration section, which affects system-wide environment variables. It edits /etc/locale.conf with at least (for the Greek locale)

LANG=el_GR.UTF-8

MSM-Locale

and with any custom settings per type, selected in the Detailed Settings tab

On the above example, this is the result:

LANG=el_GR.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8

Plasma

Plasma uses its own locale files on user session. You can easily override system settings, using the System Settings ==> Regional Settings module.

  • Create your preferred language in the Language tab.
  • Add more languages, if you need them.
  • Set the preferred order

  • Fine-tune specific settings, as well. In the Format tab, you may specify a region that matches your need for the below settings (Numbers, Time etc), and/or enable Detailed Settings, to change specific options

  • Logout and login to see the changes.

Plasma creates/edits two files to adapt your custom/user settings. For the above example, this is the result:

==> ~/.config/plasma-locale-settings.sh 

export LC_NUMERIC=el_GR.UTF-8
export LC_TIME=el_CY.UTF-8
export LC_MONETARY=el_GR.UTF-8
export LC_MEASUREMENT=el_GR.UTF-8
export LC_COLLATE=C
export LANGUAGE=el:en_US

==> ~/.config/plasma-localerc

[Formats]
LC_COLLATE=C
LC_MEASUREMENT=el_GR.UTF-8
LC_MONETARY=el_GR.UTF-8
LC_NUMERIC=el_GR.UTF-8
LC_TIME=el_CY.UTF-8
useDetailed=true

[Translations]
LANGUAGE=el:en_US

Note to TLP3 members-experienced users: Please add your findings about how DMs and DEs handle locale and keyboard layout configuration here

Troubleshooting

If you have followed the above guide and still have issues, there are possibilities of other files conflicting. Xorg, GDM and Plasma may have overriden your settings. The Archlinux wiki for Locale and Keyboard Layout is alawys the more updated place to look for a solution and of course the Manjaro Forum is always the more welcoming community.

Archlinux wiki is an ultimate source of Linux related information.

Just remember that Arch is not Manjaro so please ask Manjaro questions in the Manjaro forum.


References

Arch Linux Wiki - Locale, Xprofile, Keyboard Configuration in Xorg
Manjaro Forum Topics [1] [2]

This guide was originally written at wiki.manjaro.org and extended in time.

14 Likes

Keyboard Configuration for non-English Layouts is added.
I would personally appreciate any contribution on Kbd Layout related issues and experience, since it is future proofing and welcoming international users.

Thanks.

1 Like

i will add this

Set language for user session

For display managers that use AccountsService the locale for the user session can be set by editing:

/var/lib/AccountsService/users/$USER

[User] Language= your_locale

Do you know in which order the system finds and uses locale settings?
I have been investigating a little. It seems confusing…

1 Like

depends on
systems & users on boot
locale & localectl

Xorg / FreeDesktop
displays manager ( for login )
.xprofile or .bashrc or .xinitrc if you put EXPORT

see this
https://wiki.archlinux.fr/locale
–> with locale-check.sh

1 Like

Yes, I know this, is one of them :robot::space_invader::japanese_goblin:
Now I need the rest, xinit, DEs, they need to get in order though…
I study. It’s a long process for my skills… :paw_prints:

1 Like

Forum kindly sponsored by Bytemark