-1

How do we get a locale or all the locales associated to a country if i have the country code or time zone.

One country can have several languages, thus many locales.

user2707590
  • 1,066
  • 1
  • 14
  • 28
  • Please read [How to Ask](http://stackoverflow.com/help/how-to-ask) for a better response! – Ben Mar 02 '16 at 16:50

1 Answers1

0

This should solve your problem:

http://php.net/manual/en/locale.getallvariants.php

$arr = Locale::getAllVariants('sl_IT_NEDIS_ROJAZ_1901');
var_dump( $arr );
nakashu
  • 1,058
  • 12
  • 21
  • not really, that just gets the variants of the given locale code - it won't retrieve all the different locale codes from just the country: Belgium for instance has both `nl_BE` and `fr_BE` – CD001 Mar 02 '16 at 16:55
  • Again, not really what the OP is after - I'm not aware of any PHP library that will actually do what's being asked - to fetch all possible Locale codes for a given country (doesn't mean there isn't one of course). It wouldn't even be really practical if you were to get into all the valid RFC 3066 variants. – CD001 Mar 03 '16 at 09:21