# @hua-labs/i18n-core - AI Documentation
# Version: 2.2.0
# Auto-generated by generate-docs — do not edit manually

package:
  name: "@hua-labs/i18n-core"
  version: "2.2.0"
  description: "HUA Labs - Core i18n functionality with SSR/CSR support and state management integration"
  license: "MIT"

overview: "Lightweight, production-ready i18n library for React. Delivers zero-flicker language transitions through intelligent caching, SSR-first hydration handling, and built-in state management integration. ~6.5KB gzipped with zero dependencies (React only)."

exports:
  main:
    path: "@hua-labs/i18n-core"
    provides:
      - name: "useTranslation"
        type: "hook"
        description: "Main translation hook — returns t, tPlural, tArray, getRawValue and state"
      - name: "useLanguageChange"
        type: "hook"
        description: "Language change hook with validation against supported languages"
      - name: "useI18n"
        type: "hook"
        description: "Full context hook — all translation functions plus language management"
      - name: "I18nProvider"
        type: "component"
        description: "Direct Provider component (for advanced use)"
      - name: "Translator"
        type: "class"
        description: "Core translator class (for manual instantiation)"
      - name: "ssrTranslate"
        type: "function"
        description: "Server-side translation function (no React needed)"
      - name: "serverTranslate"
        type: "function"
        description: "Server-side translate with full config"
      - name: "webPlatformAdapter"
        type: "function"
        description: "Default web adapter — navigator.language detection + window event language sync"
      - name: "headlessPlatformAdapter"
        type: "function"
        description: "No-op adapter for SSR, testing, and Flutter bridge scenarios"
      - name: "I18nConfig"
        type: "type"
        description: ""
      - name: "I18nContextType"
        type: "type"
        description: ""
      - name: "TranslationParams"
        type: "type"
        description: "Parameters for interpolation and missing-key defaultValue fallback"
      - name: "TypedTranslationKeys"
        type: "type"
        description: ""
      - name: "ResolveStringKey"
        type: "type"
        description: ""
      - name: "ResolveArrayKey"
        type: "type"
        description: ""
      - name: "ResolvePluralKey"
        type: "type"
        description: ""
      - name: "PluralValue"
        type: "type"
        description: ""
      - name: "PluralCategory"
        type: "type"
        description: ""
      - name: "I18nPlatformAdapter"
        type: "interface"
        description: "Platform adapter interface — implement for React Native or custom environments"
      - name: "createCoreI18n"
        type: "function"
        description: "Create an i18n Provider component with configuration"
      - name: "CoreProvider"
        type: "function"
        description: "Minimal Provider with zero config"
      - name: "createLanguageProvider"
        type: "function"
        description: "Create a Provider with just a language setting"
      - name: "createNamespaceProvider"
        type: "function"
        description: "Create a Provider with just namespace settings"
      - name: "createCustomLoaderProvider"
        type: "function"
        description: "Create a Provider with custom translation loader"

  subpaths:
    - path: "@hua-labs/i18n-core/server"
      description: "Server-side translation utilities (ssrTranslate)"

features:
  - "Zero-flicker — Shows previous language during transition"
  - "SSR-first — Built-in hydration handling, no mismatch issues"
  - "Namespace lazy loading — Load translations on demand"
  - "Pluralization — ICU-compliant plural support via Intl.PluralRules (zero bundle cost)"
  - "Type-safe arrays — tArray() returns string[] without casting"
  - "State management — First-class Zustand support via i18n-core-zustand"
  - "Automatic retry — Exponential backoff for API loader failures"
  - "React Native — Works in Expo and bare RN projects via CJS/ESM dual format"
  - "~6.5KB gzipped — Zero external dependencies"
  - "Cross-platform — I18nPlatformAdapter for Web, React Native, Flutter bridge"
  - "Generic getRawValue<T>() — type-safe raw value access without casting"
  - "defaultValue fallback — t() and Translator return interpolated fallback text when lookup misses"

related_packages:
  - "@hua-labs/i18n-core-zustand"
  - "@hua-labs/eslint-plugin-i18n"
  - "@hua-labs/i18n-loaders"
  - "@hua-labs/i18n-formatters"

compatibility:
  react: ">=19.0.0"
  node: ">=20.0.0"
