The file /etc/locale.gen
does not exist on my Ubuntu 14.04 LTS, how can I add a new locale the right way ?
2 Answers
To add a new locale, you have to add it to /etc/locale.gen, save the file and run following command:
sudo locale-gen
But it is really strange, that this file is missing on your system.
Add this for American-English:
en_US.UTF-8 UTF-8
/etc/locale.gen contains all local settings and system languages in a commented format.
To add /etc/locale.gen
the right way, run the command
$ sudo apt install locale-gen --reinstall
The output would be
$ sudo apt install locales --reinstall
Reading package lists... Done
Building dependency tree
Reading state information... Done
Need to get 3,612 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu bionic/main amd64 locales all 2.27-3ubuntu1 [3,612 kB]
Fetched 3,612 kB in 17s (213 kB/s)
Preconfiguring packages ...
(Reading database ... 264543 files and directories currently installed.)
Preparing to unpack .../locales_2.27-3ubuntu1_all.deb ...
Unpacking locales (2.27-3ubuntu1) over (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up locales (2.27-3ubuntu1) ...
Generating locales (this might take a while)...
en_AG.UTF-8... done
en_AU.UTF-8... done
en_BW.UTF-8... done
en_CA.UTF-8... done
en_DK.UTF-8... done
en_GB.UTF-8... done
en_HK.UTF-8... done
en_IE.UTF-8... done
en_IL.UTF-8... done
en_IN.UTF-8... done
en_NG.UTF-8... done
en_NZ.UTF-8... done
en_PH.UTF-8... done
en_SG.UTF-8... done
en_US.UTF-8... done
en_ZA.UTF-8... done
en_ZM.UTF-8... done
en_ZW.UTF-8... done
Generation complete.
For more information - https://renenyffenegger.ch/notes/Linux/locale
/etc/locale.gen
is first used in 16.04 LTS and that is not used in 14.04 LTS.