HH\Lib\Locale\get_native

Meta Engineer?

This is available as Locale\get_native in the www repository.

Retrieve the locale being used by libc functions for the current thread

namespace HH\Lib\Locale;

function get_native(): Locale;

In general, we discourage this: it can be surprising that it changes the behavior of many libc functions, like sprintf('%f'), and error messages from native code may be translated.

For web applications, that's likely unwanted - we recommend frameworks add the concept of a 'viewer locale', and explicitly pass it to the relevant string functions instead.

Returns

  • Locale