RFC 4647 / START HERE
Language matching, before the details
Matching of Language Tags: a descriptive name, not an acronym
Content can have a language label such as de-CH for German used in Switzerland. A language range is a requested label or pattern. RFC4647 supplies rules for comparing requests with the labels actually available.
Why it exists
A search can keep every matching item, while an interface often needs one message. Basic filtering, extended filtering and lookup answer different questions. Matching does not translate content, prove a label true, or guarantee that a reader understands the result.
A familiar example
A help service has messages labeled zh-Hant and ja-JP. A reader asks for fr-FR, then zh-Hant. Lookup tries the French fallbacks before selecting the exact zh-Hant item. It does not jump to the configured Japanese default after the first miss.
Helpful background
You can start here without reading another RFC. If these ideas are unfamiliar, these short introductions may help.
What you’ll learn next
Begin with chapter one, or choose a topic.
- Read a language rangeA language tag labels content. A language range expresses which labels a user wants. Smaller pieces called subtags are separated by hyphens. Here, de-CH labels German used in Switzerland.→
- Keep basic prefix matchesFiltering returns all matching labels, possibly none. Basic filtering checks an exact label or a prefix ending at a whole-subtag boundary. It does not search inside a tag.→
- Scan extended subtagsExtended filtering can skip an intervening script subtag while preserving the requested order. An interior * does not consume exactly one piece, and an unmatched singleton stops the scan.→
- Shorten an exact lookupLookup returns one result. It tries an exact requested label, then shorter ranges from the right. Unlike filtering, it does not return a label that is more specific than the current request.→
- Exhaust preferences before defaultingA reader can list several language preferences. Lookup exhausts the first range’s shorter attempts, then tries the next range. A default comes after the whole requested list.→
This introduction explains RFC 4647 (2006). Read the original RFC ↗