Reputation: 341
I need to find a list of locale installed/supported in my linux machine. is there a way to find a list of valid locales in my linux using perl ?
thanks
Upvotes: 32
Views: 42128
Reputation: 41360
if by saying "valid locales" you wanted to check which locales are supported
then you need to go to the file (you can open it with 'nano' to check if it is still there)
nano /usr/share/i18n/SUPPORTED
tested on Ubuntu 18
Upvotes: 0
Reputation: 98398
http://perldoc.perl.org/perllocale.html#Finding-locales:
For locales available in your system, consult also setlocale(3) to see whether it leads to the list of available locales (search for the SEE ALSO section). If that fails, try the following command lines:
locale -a
nlsinfo
ls /usr/lib/nls/loc
ls /usr/lib/locale
ls /usr/lib/nls
ls /usr/share/locale
Upvotes: 2
Reputation: 50573
If you want the list of all supported locales, in my Debian distro they are in /usr/share/i18n/SUPPORTED
, so you could do:
system("cat /usr/share/i18n/SUPPORTED");
Upvotes: 10
Reputation: 22695
This command will give you a list of locales:
locale -a
From a Perl script you can execute the same using
system("locale -a");
Upvotes: 48