Skip to contents

Checks whether the primary language, script, and region subtags of a BCP 47 tag appear in the IANA Language Subtag Registry. Extension and private-use subtags are not validated.

Usage

bcp_validate(tag, registry = bcp_get_registry())

Arguments

tag

A character scalar BCP 47 language tag.

registry

A data frame of the IANA Language Subtag Registry, as returned by bcp_process_registry(). Defaults to the locally cached registry, falling back to the bundled snapshot if no cache exists.

Value

A logical scalar: TRUE if all checked subtags are registered, FALSE otherwise.

Examples

bcp_validate('en-US')
#> [1] TRUE
bcp_validate('en-Latn-US')
#> [1] TRUE
bcp_validate('xx-ZZ')
#> [1] FALSE