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.
Each pack reads its language the way people write it, not a transliteration of English. Romance packs cover tens/hundreds/scale words (ciento veinte, mille cinq cents, mil millones), ordinal days (le 1er mars), and spoken decimals (dos coma cinco). The Chinese and Japanese packs cover grouped numerals (一百五十万), comparators that follow the quantity (5キロ未満, 5公斤以上), trailing approximants (五公斤左右), and per-locale currency defaults — the shared ¥ resolves to CNY under zh and JPY under ja.
Date parsing accepts the same packs directly: parseDate("mañana", { now, locale: "es", localePacks: [es] }). Localized date grammar includes spoken clocks (las tres menos cuarto, deux heures et quart), period edges (a finales de mes), weekday offsets (lundi en huit), and CJK calendar forms — suffix dates (2026年3月5日, 3月5日), weekdays (星期三, 水曜日), clocks with day periods (午後3時半, 下午3点), and date+time written without a space (明天下午3点).