// ui_kits/website/i18n.jsx
//
// Tiny bilingual layer for Top Natural Tips. No external library — just a
// strings table, a hook, and a t() helper. Designed to scale to PT/IT later
// (just add another key to each entry); not coupled to two languages
// structurally.
//
// Site defaults to Spanish (the primary audience). Choice persists in
// localStorage and the <html lang> attribute is updated so screen readers,
// browser translation, and SEO crawlers see the active language.

const I18N_KEY = 'topnaturaltips.lang';
const LANGS = ['es', 'en'];           // primary first — defines default order in switcher
const DEFAULT_LANG = 'es';

const LANG_META = {
  es: { code: 'ES', label: 'Español' },
  en: { code: 'EN', label: 'English' },
};

// ---- Strings table -------------------------------------------------------
// Flat keys, dot-namespaced by component. Spanish drawn from the live
// topnaturaltips.com (warm, neutral LatAm, second-person tú).
const STRINGS = {
  // Header
  'header.topBar.tagline':  { es: 'Vida Sana · Cuerpo Sano · Mente Sana', en: 'Healthy Living · Healthy Body · Healthy Mind' },
  'header.brand.tagline':   { es: 'Vida Sana Cuerpo Sano Mente Sana',    en: 'Healthy Life Style' },
  'header.support':         { es: 'support@topnaturaltips.com',          en: 'support@topnaturaltips.com' },

  // Nav
  'nav.health':     { es: 'Salud',     en: 'Health' },
  'nav.beauty':     { es: 'Belleza',   en: 'Beauty' },
  'nav.nutrition':  { es: 'Nutrición', en: 'Nutrition' },
  'nav.exercise':   { es: 'Ejercicio', en: 'Exercise' },
  'nav.therapies':  { es: 'Terapias',  en: 'Therapies' },
  'nav.shop':       { es: 'Tienda',    en: 'Shop' },
  'nav.podcasts':   { es: 'Podcasts',  en: 'Podcasts' },

  // Hero
  'hero.eyebrow':   { es: 'Edición de primavera · 2026', en: 'Spring Issue · 2026' },
  'hero.title.a':   { es: 'Pequeños rituales diarios,',  en: 'Small daily rituals,' },
  'hero.title.b':   { es: 'gran cambio para toda la vida.', en: 'big lifelong change.' },
  'hero.sub':       {
    es: 'Terapias naturales, nutrición con respaldo científico y hábitos de belleza — curados por una periodista que lleva quince años haciendo las preguntas correctas. Sin extremos. Sin mitos. Solo lo que funciona.',
    en: 'Natural therapies, evidence-based nutrition, and beauty habits — curated by a journalist who has spent fifteen years asking the right questions. No extremes. No myths. Just what works.',
  },
  'hero.cta.primary':   { es: 'Lee el tip de esta semana', en: "Read this week's tip" },
  'hero.cta.secondary': { es: 'Escucha el podcast',        en: 'Listen to the podcast' },
  'hero.marquee.label': { es: 'Destacados',                en: 'Featured' },
  'hero.marquee.1': { es: 'Alivio de Sinusitis',   en: 'Sinusitis Relief' },
  'hero.marquee.2': { es: 'Alimentos que se Combinan', en: 'Foods That Pair' },
  'hero.marquee.3': { es: 'El Poder del Hielo',    en: 'The Power of Ice' },
  'hero.marquee.4': { es: 'Harvard sobre la Felicidad', en: 'Harvard on Happiness' },
  'hero.marquee.5': { es: 'Mioquimia, Explicada',  en: 'Myokymia Explained' },

  // Blog grid
  'blog.eyebrow':       { es: 'Últimas historias',         en: 'Latest stories' },
  'blog.title':         { es: 'Esta semana en el diario',  en: 'This week on the journal' },
  'blog.filter.all':    { es: 'Todos',     en: 'All' },
  'blog.viewAll':       { es: 'Ver todas las historias',  en: 'View all stories' },

  // Categories (singular labels — used in pills + filters + post meta)
  'cat.Health':     { es: 'Salud',     en: 'Health' },
  'cat.Beauty':     { es: 'Belleza',   en: 'Beauty' },
  'cat.Nutrition':  { es: 'Nutrición', en: 'Nutrition' },
  'cat.Exercise':   { es: 'Ejercicio', en: 'Exercise' },

  // Section page descriptions (under the hero title)
  'section.Health.desc': {
    es: 'Estrategias con base científica para sentirte mejor, dormir más profundo y prevenir lo que sí se puede prevenir.',
    en: 'Evidence-led strategies for feeling better, sleeping deeper, and preventing what can be prevented.',
  },
  'section.Beauty.desc': {
    es: 'Rituales que respetan tu piel — y tu tiempo. Skincare con ingredientes que reconoces y resultados que importan.',
    en: 'Rituals that respect your skin — and your time. Skincare with ingredients you recognize and results that matter.',
  },
  'section.Nutrition.desc': {
    es: 'Lo que comes importa más que cuánto. Comida real, combinaciones inteligentes, sin dietas restrictivas.',
    en: 'What you eat matters more than how much. Real food, smart pairings, no restrictive diets.',
  },
  'section.Exercise.desc': {
    es: 'Movimiento sostenible para una vida larga — fuerza, movilidad y caminar mucho. Sin gimnasios obligatorios.',
    en: 'Sustainable movement for a long life — strength, mobility, lots of walking. No mandatory gyms.',
  },
  'section.eyebrow':       { es: 'Sección',         en: 'Section' },
  'section.featured':      { es: 'Lectura destacada', en: 'Featured story' },
  'section.library':       { es: 'Más en la biblioteca', en: 'More in the library' },
  'section.library.empty': { es: 'Aún no hay más artículos en esta sección.', en: 'No more articles in this section yet.' },
  'section.back':          { es: 'Inicio',          en: 'Home' },
  'section.allTopics':     { es: 'Ver todas las secciones', en: 'Browse all sections' },

  // Date / reading-time formats — kept simple, the components compose them
  'unit.minRead':   { es: 'min de lectura', en: 'min read' },

  // About founder
  'about.eyebrow':   { es: 'Conoce a la editora', en: 'Meet the editor' },
  'about.greeting':  { es: '¡Hola! Soy Paola.',   en: 'Hello! My name is Paola.' },
  'about.title':     {
    es: 'Periodista de salud cansada de hacerle las preguntas correctas a las personas equivocadas.',
    en: "I'm a journalist who got tired of asking the wrong people the right questions.",
  },
  'about.body':      {
    es: 'Durante quince años cubrí la salud como cualquier otra reportera — repitiendo notas de prensa, citando los mismos discursos. Hasta que mi cuerpo dijo basta y los médicos solo se encogían de hombros. Empecé a leer los estudios por mi cuenta, a hablar con herbolarias, acupunturistas, nutricionistas certificados. <em>Top Natural Tips</em> es lo que aprendí: nada radical, solo bienestar paciente, basado en evidencia, en una voz que respeta tu tiempo.',
    en: 'For fifteen years I covered health like every other reporter — pulling press releases, parroting talking points. Then my body broke down and the doctors shrugged. I started reading the studies myself, talking to herbalists, acupuncturists, dietitians. <em>Top Natural Tips</em> is what I learned: nothing radical, just patient, evidence-led wellness in a voice that respects your time.',
  },
  'about.signature': { es: '— Paola D.', en: '— Paola D.' },
  'about.cta':       { es: 'Lee mi historia', en: 'Read my story' },

  // Podcast
  'pod.eyebrow':  { es: 'El Podcast',   en: 'The Podcast' },
  'pod.title':    {
    es: 'Conversaciones con quienes están cambiando la forma en que sanamos.',
    en: 'Conversations with the people changing how we heal.',
  },
  'pod.body':     {
    es: 'Cada jueves, una conversación larga y sin prisa con un médico, herbolaria o investigadora que está redefiniendo la medicina complementaria. Sin clips de 90 segundos — solo conversaciones completas de una hora.',
    en: "Each Thursday, a long-form sit-down with a doctor, herbalist, or researcher who's reshaping complementary medicine. No 90-second clips — just full hour-long conversations.",
  },
  'pod.cta.spotify': { es: 'Escucha en Spotify', en: 'Listen on Spotify' },
  'pod.cta.apple':   { es: 'Apple Podcasts',     en: 'Apple Podcasts' },
  'pod.episodeLabel':{ es: 'Episodio',           en: 'Episode' },
  'pod.minLabel':    { es: 'min',                en: 'min' },
  'pod.ep.title':    {
    es: 'Exposición al frío y el nervio vago, con la Dra. Lina Reyes',
    en: 'Cold Exposure & the Vagus Nerve, with Dr. Lina Reyes',
  },
  'pod.latest':       { es: 'Último episodio',              en: 'Latest episode' },
  'pod.newBadge':     { es: 'Nuevo esta semana',            en: 'New this week' },
  'pod.popular':      { es: 'Más escuchados',               en: 'Most listened' },
  'pod.viewAll':      { es: 'Ver todos los episodios',      en: 'View all episodes' },
  'pod.playEpisode':  { es: 'Escuchar episodio',            en: 'Play episode' },

  // Podcast page (dedicated)
  'podp.eyebrow':       { es: 'El Podcast',                en: 'The Podcast' },
  'podp.kicker':        { es: 'Top Natural Tips',           en: 'Top Natural Tips' },
  'podp.title': {
    es: 'Salud, bienestar y belleza — explicados sin prisa, con fundamento, en menos de cinco minutos.',
    en: 'Health, wellness, and beauty — explained without rushing, grounded in science, in under five minutes.',
  },
  'podp.subtitle': {
    es: '¿Buscas sentirte mejor por dentro y por fuera, de forma real y sin complicarte la vida? Cada episodio: una idea, los estudios que la respaldan, y un pequeño hábito que puedes probar hoy. Conducido por Paola D.K., periodista de salud y health coach.',
    en: 'Looking to feel better inside and out — for real, without overcomplicating it? Each episode: one idea, the studies behind it, and a small habit you can try today. Hosted by Paola D.K., health journalist and certified health coach.',
  },
  'podp.host':            { es: 'Conducido por',             en: 'Hosted by' },
  'podp.hostName':        { es: 'Paola D.K.',                en: 'Paola D.K.' },
  'podp.hostRole':        { es: 'Periodista de salud · Health coach', en: 'Health journalist · Health coach' },
  'podp.stat.episodes':   { es: 'episodios',                 en: 'episodes' },
  'podp.stat.category':   { es: 'Salud y Bienestar',          en: 'Health & Fitness' },
  'podp.stat.language':   { es: 'Español',                   en: 'Spanish' },
  'podp.stat.cadence':    { es: 'Nuevo capítulo cada semana', en: 'New episode every week' },
  'podp.cta.spotify':     { es: 'Escuchar en Spotify',        en: 'Listen on Spotify' },
  'podp.cta.apple':       { es: 'Apple Podcasts',             en: 'Apple Podcasts' },
  'podp.cta.follow':      { es: 'Sigue el podcast',           en: 'Follow the podcast' },
  'podp.cta.copy':        { es: 'Copiar enlace RSS',          en: 'Copy RSS link' },
  'podp.cta.copied':      { es: '✓ Enlace copiado',          en: '✓ Link copied' },
  'podp.featured.eyebrow':{ es: 'Último episodio',            en: 'Latest episode' },
  'podp.featured.play':   { es: 'Reproducir episodio',        en: 'Play episode' },
  'podp.featured.embed':  { es: 'Reproductor de Spotify',     en: 'Spotify player' },
  'podp.episodes.title':  { es: 'Todos los episodios',        en: 'All episodes' },
  'podp.episodes.count':  { es: 'episodios publicados',       en: 'published episodes' },
  'podp.episodes.search.placeholder':{ es: 'Buscar episodios…', en: 'Search episodes…' },
  'podp.episodes.filter.all':       { es: 'Todos',             en: 'All' },
  'podp.episodes.filter.mind':      { es: 'Mente',             en: 'Mind' },
  'podp.episodes.filter.body':      { es: 'Cuerpo',            en: 'Body' },
  'podp.episodes.filter.nutrition': { es: 'Nutrición',          en: 'Nutrition' },
  'podp.episodes.empty':  { es: 'Ningún episodio coincide con tu búsqueda.', en: 'No episodes match your search.' },
  'podp.episodes.play':   { es: 'Reproducir',                  en: 'Play' },
  'podp.episodes.show':   { es: 'Mostrar más',                 en: 'Show more' },
  'podp.episodes.loadMore':{ es: 'Cargar más episodios',        en: 'Load more episodes' },
  'podp.episodes.showing':{ es: 'Mostrando',                    en: 'Showing' },
  'podp.episodes.appleLink':{ es: 'Abrir en Apple',            en: 'Open in Apple' },
  'podp.episodes.spotifyLink':{ es: 'Abrir en Spotify',         en: 'Open in Spotify' },
  'podp.platforms.eyebrow':{ es: 'Suscríbete donde escuches',   en: 'Subscribe wherever you listen' },
  'podp.platforms.title':  { es: 'Disponible en todas las plataformas.', en: 'Available on every platform.' },
  'podp.platforms.spotify':{ es: 'Spotify',                     en: 'Spotify' },
  'podp.platforms.apple':  { es: 'Apple Podcasts',              en: 'Apple Podcasts' },
  'podp.platforms.google': { es: 'Google Podcasts',             en: 'Google Podcasts' },
  'podp.platforms.amazon': { es: 'Amazon Music',                en: 'Amazon Music' },
  'podp.platforms.yt':     { es: 'YouTube',                     en: 'YouTube' },
  'podp.platforms.rss':    { es: 'RSS',                          en: 'RSS' },
  'podp.about.eyebrow':   { es: 'Sobre el podcast',              en: 'About the show' },
  'podp.about.title':     { es: '¿De qué hablamos en cada capítulo?', en: "What do we talk about each week?" },
  'podp.about.body': {
    es: 'Cada episodio dura entre 3 y 6 minutos — el tiempo justo para entender una idea, no para diluirla. Cito los estudios. Nombro los journals. No vendo suplementos. Si una sesión es de fitness, hablamos de fitness; si es de salud emocional, traemos a psicólogos. Sin sermones, sin moralina y sin pseudociencia.',
    en: 'Every episode runs 3–6 minutes — long enough to understand an idea, short enough not to dilute it. I cite studies. I name journals. I don\'t sell supplements. If it\'s a fitness episode, we talk fitness; if it\'s emotional health, we bring in psychologists. No sermons, no moralizing, no pseudoscience.',
  },
  'podp.about.b1.title':  { es: 'Mente sana',                    en: 'Healthy mind' },
  'podp.about.b1.body':   { es: 'Neurociencia accesible — metacognición, regulación emocional, descanso reparador.', en: 'Approachable neuroscience — metacognition, emotional regulation, restorative rest.' },
  'podp.about.b2.title':  { es: 'Cuerpo sano',                   en: 'Healthy body' },
  'podp.about.b2.body':   { es: 'Hábitos basados en evidencia: movimiento, fuerza, prevención y nutrientes que importan.', en: 'Evidence-based habits: movement, strength, prevention, and the nutrients that matter.' },
  'podp.about.b3.title':  { es: 'Vida consciente',                en: 'Conscious living' },
  'podp.about.b3.body':   { es: 'Maternidad, validación, autocuidado real — sin filtros, con la voz de quien también lo vive.', en: 'Motherhood, validation, real self-care — unfiltered, in the voice of someone living it too.' },
  'podp.cta.banner.title': { es: 'No te pierdas el próximo episodio.', en: "Don't miss next week's episode." },
  'podp.cta.banner.body':  { es: 'Suscríbete en tu plataforma favorita y recibe el aviso cada jueves a las 6 a.m.', en: 'Subscribe on your favorite platform and get a heads-up every Thursday at 6 a.m.' },

  // Shop
  'shop.eyebrow':  { es: 'La Tienda', en: 'The Shop' },
  'shop.title':    { es: 'Lo que realmente tenemos en el estante.', en: 'What we actually keep on the shelf.' },
  'shop.sub':      {
    es: 'Suplementos seleccionados a mano y skincare de pequeños lotes. Probamos cada producto al menos un mes antes de tenerlo en stock.',
    en: 'Hand-picked supplements and small-batch skincare. We tried each one for at least a month before stocking it.',
  },
  'shop.viewAll':  { es: 'Ver todos los productos', en: 'View all products' },
  'shop.badge.bestseller': { es: 'Más vendido', en: 'Bestseller' },
  'shop.badge.new':        { es: 'Nuevo',        en: 'New' },

  // Newsletter
  'news.eyebrow':       { es: 'La Nota del Domingo', en: 'The Sunday Note' },
  'news.title.a':       { es: 'Un pequeño hábito,',  en: 'One small habit,' },
  'news.title.b':       { es: 'cada domingo por la mañana.', en: 'every Sunday morning.' },
  'news.body':          {
    es: 'Una carta breve de Paola — un ritual, una receta, un estudio que vale la pena leer. Sin marketing, sin contenido patrocinado, sin fricción para darse de baja.',
    en: 'A short letter from Paola — one ritual, one recipe, one study worth reading. No marketing, no sponsored content, no unsubscribe friction.',
  },
  'news.placeholder':   { es: 'tu@correo.com', en: 'hello@yourname.com' },
  'news.submit':        { es: 'Suscríbete',    en: 'Subscribe' },
  'news.success':       {
    es: '✓ Ya estás en la lista. La primera nota llega el domingo a las 7 a.m.',
    en: "✓ You're on the list. First note arrives Sunday at 7 a.m.",
  },
  'news.privacy':       {
    es: 'Nunca compartimos tu correo. Lee nuestra <a>política de privacidad</a>.',
    en: 'We never share your email. Read our <a>privacy policy</a>.',
  },

  // Footer
  'foot.mission': {
    es: 'Curamos las mejores soluciones naturales para tu salud y bienestar. Vida sana, cuerpo sano, mente sana — escrito desde Los Ángeles, leído en todas partes.',
    en: 'Curating the best natural solutions for your health and wellness needs. Healthy living, healthy body, healthy mind — written from Los Angeles, read everywhere.',
  },
  'foot.col.explore': { es: 'Explora',   en: 'Explore' },
  'foot.col.more':    { es: 'Más',       en: 'More' },
  'foot.col.legal':   { es: 'Legal',     en: 'Legal' },
  'foot.naturalTherapies': { es: 'Terapias Naturales', en: 'Natural Therapies' },
  'foot.courses':     { es: 'Cursos en línea', en: 'Online Courses' },
  'foot.aboutPaola':  { es: 'Sobre Paola', en: 'About Paola' },
  'foot.contact':     { es: 'Contacto',    en: 'Contact' },
  'foot.terms':       { es: 'Términos de uso',      en: 'Terms of Use' },
  'foot.privacy':     { es: 'Política de privacidad', en: 'Privacy Policy' },
  'foot.sale':        { es: 'Términos de venta',    en: 'Terms of Sale' },
  'foot.medical':     { es: 'Aviso médico',         en: 'Medical Disclaimer' },
  'foot.disclaimer':  {
    es: 'El contenido de Top Natural Tips tiene fines educativos únicamente y no sustituye el consejo médico profesional, el diagnóstico ni el tratamiento. Consulta siempre con tu médico u otro profesional de la salud calificado ante cualquier duda sobre una condición médica.',
    en: 'The content on Top Natural Tips is intended for educational purposes only and is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.',
  },
  'foot.copyright': { es: '© 2026 topnaturaltips, LLC · Los Ángeles, CA', en: '© 2026 topnaturaltips, LLC · Los Angeles, CA' },

  // Videos
  'videos.eyebrow':   { es: 'En video',                en: 'On video' },
  'videos.title':     { es: 'Mira esta semana',        en: 'Watch this week' },
  'videos.sub':       {
    es: 'El canal de YouTube — protocolos rápidos, entrevistas largas, demostraciones a cámara lenta. Suscríbete para no perderte nada.',
    en: 'The YouTube channel — quick protocols, long interviews, slow-motion demos. Subscribe so nothing slips past you.',
  },
  'videos.subscribe': { es: 'Suscríbete en YouTube',    en: 'Subscribe on YouTube' },
  'videos.viewAll':   { es: 'Ver todos los videos',    en: 'View all videos' },
  'videos.watchOn':   { es: 'Ver en YouTube',          en: 'Watch on YouTube' },
  'videos.recent':    { es: 'Más recientes',            en: 'Most recent' },
  'videos.sectionEyebrow': { es: 'Mira',               en: 'Watch' },
  'videos.sectionCta': { es: 'Reproducir',             en: 'Play' },
  'videos.shortsTitle': { es: 'Shorts',                en: 'Shorts' },
  'videos.shortsAll':   { es: 'Ver todos',             en: 'View all' },

  // Article (post detail) page
  'article.back':         { es: 'Volver',               en: 'Back' },
  'article.toc':          { es: 'En este artículo',     en: 'In this article' },
  'article.share':        { es: 'Compartir',            en: 'Share' },
  'article.shareCopy':    { es: 'Copiar enlace',        en: 'Copy link' },
  'article.shareCopied':  { es: '✓ Enlace copiado',      en: '✓ Link copied' },
  'article.shareEmail':   { es: 'Compartir por correo', en: 'Share by email' },
  'article.shareWhats':   { es: 'Compartir en WhatsApp',en: 'Share on WhatsApp' },
  'article.related':      { es: 'Más en esta sección',  en: 'More in this section' },
  'article.newsletterCta':{
    es: 'Lee este tipo de notas cada domingo a la mañana.',
    en: 'Read pieces like this every Sunday morning.',
  },
  'article.authorMore':   { es: 'Más historias de Paola', en: 'More stories from Paola' },
  'article.readTime':     { es: 'min de lectura',       en: 'min read' },
  'article.published':    { es: 'Publicado',            en: 'Published' },
  'article.updated':      { es: 'Actualizado',          en: 'Updated' },

  // PostModal — generic body when no per-post copy
  'post.lede.default': {
    es: 'Una mirada breve y basada en evidencia a una cosa pequeña que puedes hacer esta semana — se lee en menos de cinco minutos, se prueba en menos de un día.',
    en: 'A short, evidence-led look at one small thing you can do this week — read in under five minutes, try in under a day.',
  },
  'post.body.1': {
    es: 'Te sorprenderá con qué frecuencia la respuesta no es una pastilla nueva ni un dispositivo elegante — es algo que tu abuela probablemente ya te dijo, solo que dicho con palabras más antiguas. Esta semana revisamos uno de esos casos.',
    en: "You'd be surprised how often the answer isn't a new pill or a fancy device — it's something your grandmother probably told you, just dressed up in older language. This week we're looking at one of those.",
  },
  'post.body.2': {
    es: 'El mecanismo es simple. La evidencia es modesta pero real. El costo es prácticamente cero. Abajo, el protocolo — y los estudios, por si quieres leer los artículos originales tú misma.',
    en: 'The mechanism is simple. The evidence is modest but real. The cost is roughly zero. Below, the protocol — and the studies, in case you want to read the underlying papers yourself.',
  },
  'post.disclaimer': {
    es: 'Este artículo tiene fines educativos únicamente. No es consejo médico. Consulta a tu médico antes de cambiar cualquier tratamiento, especialmente si estás embarazada, en período de lactancia o tomando medicamentos.',
    en: 'This article is for educational purposes only. It is not medical advice. Please consult your physician before changing any treatment, especially if you are pregnant, nursing, or taking medication.',
  },
  'post.author.role': { es: 'Periodista y Life Coach', en: 'Journalist & Life Coach' },
};

// ---- Hook + helper -------------------------------------------------------

function getInitialLang() {
  try {
    const saved = localStorage.getItem(I18N_KEY);
    if (saved && LANGS.includes(saved)) return saved;
  } catch (e) { /* private mode */ }
  return DEFAULT_LANG;
}

function useLang() {
  const [lang, setLangState] = React.useState(getInitialLang);

  React.useEffect(() => {
    document.documentElement.setAttribute('lang', lang);
    try { localStorage.setItem(I18N_KEY, lang); } catch (e) {}
  }, [lang]);

  const setLang = React.useCallback((next) => {
    if (LANGS.includes(next)) setLangState(next);
  }, []);

  return [lang, setLang];
}

function t(key, lang) {
  const entry = STRINGS[key];
  if (!entry) {
    if (typeof console !== 'undefined') console.warn('[i18n] missing key:', key);
    return key;
  }
  return entry[lang] ?? entry[DEFAULT_LANG] ?? '';
}

// LangContext lets nested components reach lang without prop-drilling for
// strings; the top-level App still passes lang explicitly to anything that
// branches on it for layout (Header, etc.) for clarity.
const LangContext = React.createContext(DEFAULT_LANG);

function useT() {
  const lang = React.useContext(LangContext);
  return React.useCallback((key) => t(key, lang), [lang]);
}

// Export to window so other Babel-scoped scripts can use these.
Object.assign(window, {
  I18N_LANGS: LANGS,
  I18N_LANG_META: LANG_META,
  I18N_DEFAULT_LANG: DEFAULT_LANG,
  I18N_STRINGS: STRINGS,
  useLang,
  useT,
  t,
  LangContext,
});
