Visual RFC.
ALL RFCs / RFC 4647
Read the RFC ↗
RFC 4647 / LANGUAGE MATCHING

Shorten an exact lookup

04

Lookup 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.

RFC 4647 · § 3.4EXAMPLE
4 / 4
04
Find the shorter exact label

Try zh-Hant. That item exists, so return it and stop before zh or the default. No content is translated.

Shorten an exact lookupTry zh-Hant. That item exists, so return it and stop before zh or the default. No content is translated.Lookup · one exact resultAvailable: zh-Hant and enzh-Hant-CN-x-private1-private2zh-Hant-CN-x-private1zh-Hant-CNzh-HantReturn: zh-HantStop before zh or the default

Key idea: Lookup tries exact labels and shorter fallbacks; filtering keeps matching extensions.

Terms
Lookup
Select one exact label, trying less-specific requested ranges before a defined default.
Fallback
Try a less-specific request when the current attempt has no match.

Look up a term in the glossary ↗

Rules & examples
  • RFC4647§3.4 says a request de-CH can return de-CH or de, but never de-CH-1996. Do not reuse the basic-filter prefix test as the lookup equality test.
  • The RFC example tries zh-Hant-CN-x-private1-private2, then zh-Hant-CN-x-private1, zh-Hant-CN, zh-Hant, zh, then default.
  • A single-letter or digit subtag is removed together with its closest trailing subtag during truncation. Removing private1 also removes the now-trailing x.
  • Available content here is zh-Hant and en. The search stops at the exact zh-Hant label; returned content keeps its label. The private-use sequence illustrates truncation, not standardized meaning.
  • This bounded helper accepts basic ranges only. Applications accepting extended ranges MUST define which item to return when multiple items match; §3.4 permits such application policies.

The long truncation pattern is from §3.4. Redundant or private-use subtags can interfere with selection; users SHOULD avoid unnecessary distinctions (§4.1). No extension stripping or full language-tag validation is implemented.

Sources
Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

Requested languages and available labels

Imagine a catalog of labeled documents. A filter keeps all labels that fit a pattern; a lookup tries preferences and returns one exact label or a defined default. Neither operation translates the document or guarantees understanding.

Helpful first, if these ideas are unfamiliar

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

All chapters in RFC 4647

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗