isWellFormedBCP47 property

bool get isWellFormedBCP47

Check if the locale is well-formed BCP47 language tag

It must either be:

  • a normal language tag (fitting the BCP47 ABNF); or
  • a grandfathered tag; or
  • a private use tag (starting with x-).

See: https://www.ietf.org/rfc/bcp/bcp47.html#section-2.2.9

Implementation

bool get isWellFormedBCP47 =>
    (isWellFormed && lang != null) ||
    isGrandfatheredIrregular ||
    isWellFormedPrivateUse;