Locale::minimizeSubtags

locale_minimize_subtags

Remove likely subtags from a locale

Description

Object-oriented style

public static stringfalse Locale::minimizeSubtags(string $locale)

Procedural style

stringfalse locale_minimize_subtags(string $locale)

Minimizes a locale tag by removing subtags that can be inferred using the ICU likely subtag data. For example, en_Latn_US becomes en.

Parameters

locale
The locale to minimize.

Return Values

Returns the locale with likely subtags removed, or false on failure.

Errors/Exceptions

Throws a ValueError when the locale argument contains null bytes.

See Also

  • Locale::addLikelySubtags
  • Locale::canonicalize