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

    Function localeFromRequest

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

    • Resolve the locale for a standard Request: the locale cookie wins; else negotiate from Accept-Language. Workers-safe (only reads request.headers). This is the server cookie→locale resolution the app calls per request.

      Parameters

      • config: LocaleConfig
      • request: Request
      • cookieName: string = "locale"

      Returns string