Skip to content
lingo

Locales

Load tree-shakeable language packs for parsing.

Prefer the live demos? Open this section in the interactive docs.

Locale packs are opt-in and tree-shakeable. English is built in; load overlays with createLingo({ locales }) and pass locale when a field is known, or omit it for auto-detection among loaded packs plus English.

import { createLingo } from '@pascal-app/lingo'
import { es } from '@pascal-app/lingo/locales/es'
import { fr } from '@pascal-app/lingo/locales/fr'

const lingo = createLingo({ locales: [es, fr] })
lingo.parse('dos kg') // locale: 'es'
lingo.parse('72 in to cm') // locale: 'en'

Published packs: @pascal-app/lingo/locales/en, en-gb, es, fr, pt, zh, and ja. Pack-owned CJK unit aliases and fuzzy words are only registered when their pack is loaded. Passing an explicit locale that was not loaded returns LOCALE_NOT_LOADED instead of silently falling back to English.

Date parsing accepts the same packs directly: parseDate("mañana", { now, locale: "es", localePacks: [es] }).