Skip to content

createTranslator

createTranslator(input): Translator

Defined in: translator.ts:54

Negotiates a catalogue chain and returns a lookup over it.

Each requested range is truncated a subtag at a time (RFC 4647 §3.4), and every catalogue matching along the way joins the chain in that order — so asking for fr-CA consults the fr-CA catalogue, then fr, before giving up. A range matching nothing is skipped rather than failing the whole negotiation.

Negotiation happens once, here. Each lookup is then O(chain length), which is the number of locales that actually matched.

TranslatorInput

Translator