INNER CODE UNIT · TypeScript

affected

dietrichmax/colota · apps/mobile/src/i18n/index.ts:21

  const affected = SUPPORTED_LANGUAGES.filter((l) => COMPLEX_PLURAL_LANGUAGES.includes(l))
  if (affected.length > 0) {
    throw new Error(
      `Intl.PluralRules is missing but ${affected.join(", ")} need it. i18next would silently use ` +
        "English plural rules. Add @formatjs/intl-pluralrules."
    )
  }
  logger.warn("[i18n] Intl.PluralRules is unavailable; add @formatjs/intl-pluralrules before a language needs it")
}

export function initI18n(): SupportedLanguage {
  const deviceTag = NativeLocationService.getBuildConfig()?.APP_LANGUAGE
  const language = resolveLanguage(deviceTag)

  i18next.init({ ...I18N_OPTIONS, lng: language })

  checkPluralRules()
  logger.debug(`[i18n] Initialised as '${language}' (device reported '${deviceTag ?? "unknown"}')`)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…