Returns the canonicalized locale string, or undefined if the locale is invalid. Uses Intl.getCanonicalLocales for strict validation.
Intl.getCanonicalLocales
The locale string to validate (e.g., 'en_US' or 'en-US')
The canonical locale string, or undefined on failure
canonicalLocale('en_US'); // 'en-US' Copy
canonicalLocale('en_US'); // 'en-US'
Returns the canonicalized locale string, or undefined if the locale is invalid. Uses
Intl.getCanonicalLocalesfor strict validation.