Knowledge Base

Browse our knowledge base for free solutions to common problems

How To Add Locales To Rocky Linux 9

Created On: 23 February 2023
Written by: Ben

Introduction

In Linux, a locale is a set of parameters that defines the user's language, region, and cultural preferences. The locale determines the language used for displaying messages, the date and time formats, the currency symbol, and other formatting options.

A locale is identified by a name that consists of two parts: a language code and a country or region code. For example, the locale en_US represents the English language as used in the United States. Similarly, fr_CA represents French as used in Canada.

Having proper locales set up is important for programs to display output correctly and to handle user input consistently.

Installing Locales On Rocky Linux 9

To list any available locales to install we can run the following command via SSH:

dnf list glibc-langpack-*

Example output:

[root@server ~]# dnf list glibc-langpack-*
Last metadata expiration check: 0:34:49 ago on Thu 23 Feb 2023 06:15:20 PM UTC.
Installed Packages
glibc-langpack-en.x86_64                                                  2.34-40.el9_1.1                                                  @baseos
glibc-langpack-es.x86_64                                                  2.34-40.el9_1.1                                                  @baseos
Available Packages
glibc-langpack-aa.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-af.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-agr.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ak.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-am.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-an.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-anp.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ar.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-as.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ast.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ayc.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-az.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-be.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-bem.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ber.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-bg.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-bhb.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-bho.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-bi.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-bn.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-bo.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-br.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-brx.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-bs.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-byn.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ca.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ce.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-chr.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ckb.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-cmn.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-crh.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-cs.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-csb.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-cv.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-cy.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-da.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-de.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-doi.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-dsb.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-dv.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-dz.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-el.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-eo.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-et.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-eu.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-fa.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ff.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-fi.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-fil.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-fo.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-fr.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-fur.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-fy.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ga.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-gd.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-gez.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-gl.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-gu.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-gv.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ha.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-hak.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-he.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-hi.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-hif.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-hne.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-hr.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-hsb.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ht.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-hu.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-hy.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ia.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-id.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ig.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ik.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-is.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-it.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-iu.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ja.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ka.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-kab.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-kk.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-kl.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-km.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-kn.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ko.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-kok.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ks.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ku.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-kw.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ky.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-lb.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-lg.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-li.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-lij.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ln.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-lo.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-lt.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-lv.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-lzh.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mag.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mai.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mfe.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mg.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mhr.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mi.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-miq.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mjw.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mk.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ml.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mn.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mni.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mnw.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mr.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ms.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-mt.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-my.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-nan.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-nb.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-nds.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ne.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-nhn.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-niu.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-nl.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-nn.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-nr.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-nso.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-oc.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-om.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-or.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-os.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-pa.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-pap.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-pl.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ps.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-pt.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-quz.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-raj.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ro.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ru.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-rw.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sa.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sah.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sat.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sc.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sd.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-se.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sgs.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-shn.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-shs.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-si.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sid.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sk.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sl.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sm.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-so.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sq.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sr.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ss.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-st.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sv.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-sw.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-szl.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ta.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-tcy.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-te.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-tg.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-th.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-the.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ti.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-tig.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-tk.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-tl.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-tn.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-to.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-tpi.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-tr.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ts.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-tt.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ug.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-uk.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-unm.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ur.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-uz.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-ve.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-vi.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-wa.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-wae.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-wal.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-wo.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-xh.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-yi.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-yo.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-yue.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-yuw.x86_64                                                 2.34-40.el9_1.1                                                  baseos 
glibc-langpack-zh.x86_64                                                  2.34-40.el9_1.1                                                  baseos 
glibc-langpack-zu.x86_64                                                  2.34-40.el9_1.1                                                  baseos

Now we can install our preferred locale of French with the following command:

dnf install glibc-langpack-fr.x86_64

List Installed Locales

After the install is complete we can list the installed locales with the following command:

localectl list-locales

Example output:

[root@server ~]# localectl list-locales
C.UTF-8
en_AU.UTF-8
en_BW.UTF-8
en_CA.UTF-8
en_DK.UTF-8
en_GB.UTF-8
en_HK.UTF-8
en_IE.UTF-8
en_NZ.UTF-8
en_PH.UTF-8
en_SC.UTF-8
en_SG.UTF-8
en_US.UTF-8
en_ZA.UTF-8
en_ZW.UTF-8
es_AR.UTF-8
es_BO.UTF-8
es_CL.UTF-8
es_CO.UTF-8
es_CR.UTF-8
es_DO.UTF-8
es_EC.UTF-8
es_ES.UTF-8
es_GT.UTF-8
es_HN.UTF-8
es_MX.UTF-8
es_NI.UTF-8
es_PA.UTF-8
es_PE.UTF-8
es_PR.UTF-8
es_PY.UTF-8
es_SV.UTF-8
es_US.UTF-8
es_UY.UTF-8
es_VE.UTF-8

Set a Default Locale

To se a default locale we can use the identifier from the list produced above and run the following:

localectl set-locale LANG=<IDENTIFIER>

For example:

localectl set-locale LANG=en_US.UTF-8

Confirm Locale Selection

To confirm that the correct locale is set we can run the following:

localectl status

Example output:

[root@server ~]# localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: us
      X11 Layout: us
ICTU LTD is a company registered England and Wales (Company No. 09344913) 15 Queen Square, Leeds, West Yorkshire, England, LS2 8AJ
Copyright © 2024 ICTU LTD, All Rights Reserved.
exit