Benjamin Benjamin - 1 month ago 6
PHP Question

Is there a way to get the list of available locales in PHP?

In Java, you can call

Locale.getAvailableLocales()
to get the list of available locales.

I was expecting an equivalent from the PHP Locale class, but could not find one.

Is there a way to get an array of all valid Locales?

Answer Source

I don't think there is a built in functions for this. You need to ask the operating system which locales are installed.

For example, if you run on a unix system you will need to execute the command:

$ locale -a