@suluk/i18n - v0.1.0
    Preparing search index...

    Function negotiateLocale

    @suluk/i18n — the locale primitive every content app needs. Consolidates the fragmented i18n surface into one package: a typed locale/direction model (defineLocales/dirOf), a Workers-safe message loader with default-locale fallback + {token} interpolation (t), compile-time key-parity + a runtime completeness grade, Intl number/ currency/date formatting (incl. Eastern-Arabic numerals), and framework-agnostic cookie→locale resolution. The catalog CONTENT is app-authored; this owns the MECHANISM. Astro middleware glue is the @suluk/i18n/astro subpath. CANDIDATE tooling.

    • Negotiate the best supported locale from an Accept-Language header (q-weighted; exact then primary-subtag match). Returns the default when nothing matches. Used as a fallback when no locale cookie is set.

      Parameters

      • config: LocaleConfig
      • acceptLanguage: string | null | undefined

      Returns string