is there a way to find list of valid locales in my

2019-04-18 14:11发布

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

4条回答
兄弟一词,经得起流年.
2楼-- · 2019-04-18 14:37

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");
查看更多
我只想做你的唯一
3楼-- · 2019-04-18 14:43

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
查看更多
混吃等死
4楼-- · 2019-04-18 14:55
my @locale_list = `locale -a`;
chomp(@locale_list);
查看更多
Emotional °昔
5楼-- · 2019-04-18 14:57

This command will give you a list of locales:

locale -a

From a Perl script you can execute the same using

system("locale -a");
查看更多
登录 后发表回答