{"version":3,"file":"i18nEnabled.mjs","names":["isI18nDisabled","override","setI18nEnabled","enabled","isI18nStackEnabled"],"sources":["../../../src/utilities/i18n/i18nEnabled.ts"],"sourcesContent":["import { isI18nDisabled } from '../env';\n\n/**\n * Resolved on/off state for the whole translation stack.\n *\n * Lives in its own module rather than in initializeI18n so that languageSource\n * and the shell can read it without importing initializeI18n - which imports\n * languageSource, and the cycle would be resolved at module-eval time with one\n * side still undefined.\n *\n * Precedence: an explicit `enabled` passed to initializeUnityI18n wins over the\n * .env flag, so a test or a single embedded surface can override the app-wide\n * setting without touching the environment.\n *\n * Note the deliberate polarity flip: the .env variable is negative\n * (REACT_APP_I18N_DISABLED, default false) because that is how a feature kill\n * switch reads in a config file, while the code-facing predicate is positive so\n * guards read `if (!isI18nStackEnabled()) return;` without a double negative.\n */\nlet override: boolean | undefined;\n\n/** Record the explicit option (called from initializeUnityI18n). */\nexport const setI18nEnabled = (enabled?: boolean): void => {\n  override = enabled;\n};\n\n/**\n * True unless the app opted out. Everything that costs a request or a chunk -\n * the locale imports, the udp.Translation fetch, the language probe, the\n * switcher - must check this first.\n *\n * When false, `t()` still works: every library call site carries its English\n * text as an inline `defaultValue`, which is exactly how English renders when\n * the stack IS enabled (there is no en-US bundle either way). So disabling this\n * yields a working English UI, not raw keys.\n */\nexport const isI18nStackEnabled = (): boolean => override ?? !isI18nDisabled();\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAIC;;AAGJ,MAAaC,kBAAkBC,YAA4B;AACzDF,YAAWE;;;;;;;;;;;;AAab,MAAaC,2BAAoCH,YAAY,CAACD,gBAAgB"}