Function canonicalizeLocaleIdentifier

  • this function canonicalizes locale identifiers to the format /^[a-z]{2,3}_[A-Z]{2}$/ input values can contain dashes instead of underscores, wrong lower/upper case is fixed additionally languages without a region get mapped to the proper default locale if no generic locale exists e.g. currently en => en_US, de => de_DE

    Parameters

    • locale: string

    Returns string | null