What is Language Tag (BCP 47)?
BCP 47 is the IETF standard for language tags, the identifiers you see in HTML lang attributes, the Accept-Language header, and most web APIs. A tag is built from subtags: a primary language subtag (usually ISO 639-1, like en or es), optionally a script subtag (ISO 15924, like Hant for Traditional Chinese), a region subtag (ISO 3166-1, like US or BR), and further variants. Examples: en, en-US, zh-Hant, sr-Latn-RS.
The distinction from ISO 639-1 matters: ISO 639-1 is just the list of two-letter language codes, one ingredient. BCP 47 is the grammar that composes those codes with scripts and regions into a full identifier, plus matching rules for finding the best available locale for a request.
Convention note: BCP 47 uses hyphens (en-US), while POSIX and PHP locale identifiers use underscores (en_US). Web-facing surfaces like the HTML lang attribute should get the hyphenated form, so convert at the boundary if your app stores locales with underscores.