79820385

Date: 2025-11-14 19:35:54
Score: 1
Natty:
Report link

Yes, but not in the form of a simple built-in mapping table. Windows uses its own locale naming scheme and PHP does not translate between BCP47 tags like en-US and Windows names like English_United States. To get a proper mapping you need to query what Windows itself exposes.

You can do that with the intl extension. The ResourceBundle for the root locale contains the Windows locale identifiers and their corresponding BCP47 tags. With that data you can build your own lookup table at runtime. Another option is to call Locale::canonicalize on the BCP47 tag and then use Locale::getDisplayLanguage and Locale::getDisplayRegion to compose a Windows style name. Both methods give you a consistent way to turn something like en-US into the Windows name that setlocale will actually understand.

Outside PHP the official source for the mapping is the list of Windows locale identifiers published by Microsoft. That list includes the Windows locale names, the numeric identifiers, and the matching BCP47 tags. If you need a complete and static table this document is the closest thing to an authoritative reference.

Reasons:
  • Blacklisted phrase (1): this document
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Hunt3r5o4