9
I have a PHP back-end to which several types of devices communicate via a public API. Requests normally contain a required language for the response (e.g. 'en' or 'fr' or 'ru', etc.) - but not the full locale. This has worked fine for everything I needed over the last couple of years. However now I need to include date information in the response - and need a locale to format dates.
How can I get a locale from the language? I do understand that a language is not enough to uniquely identify a locale, but I need at least something. If I can get at least one locale, e.g. en_GB for 'en' or 'ru_RU' for 'ru', etc. - that would be sufficient.