This is available as
Locale\from_environment in the www repository.
Retrieve the active locale from the native environment
namespace HH\Lib\Locale; function from_environment(): Locale;
This is usually set based on the
LC_* environment variables.
Web applications targeting diverse users should probably not use this, however it is useful when aiming to support diverse users in CLI programs.