The language tag to test
The basic language range to match against
true if the tag matches the range pattern; false otherwise
import { matchTag } from "@metreeca/core/language";
matchTag("de-CH", "de"); // true - de-CH has subtag prefix de
matchTag("de-CH", "de-CH"); // true - exact match
matchTag("de", "de-CH"); // false - range is longer than tag
matchTag("deu", "de"); // false - de is not a subtag prefix of deu
matchTag("en-US", "*"); // true - wildcard matches any tag
Checks if a language tag matches a basic language range.
Implements Basic Filtering per RFC 4647 § 3.3.1. Matching is case-insensitive:
*range matches any language tag-)