Live video on the AT Protocol
79
fork

Configure Feed

Select the types of activity you want to include in your feed.

at eli/segmentation-fixes 56 lines 2.0 kB view raw
1// Native translation loader - imports translations directly for bundling 2// Metro will use this file for React Native builds 3 4// Import all translations directly so they're bundled into the app 5import enUSCommon from "../../public/locales/en-US/common.json"; 6import enUSSettings from "../../public/locales/en-US/settings.json"; 7import esESCommon from "../../public/locales/es-ES/common.json"; 8import esESSettings from "../../public/locales/es-ES/settings.json"; 9import frFRCommon from "../../public/locales/fr-FR/common.json"; 10import frFRSettings from "../../public/locales/fr-FR/settings.json"; 11import ptBRCommon from "../../public/locales/pt-BR/common.json"; 12import ptBRSettings from "../../public/locales/pt-BR/settings.json"; 13import zhHantCommon from "../../public/locales/zh-Hant/common.json"; 14import zhHantSettings from "../../public/locales/zh-Hant/settings.json"; 15 16const translationMap: Record<string, any> = { 17 "en-US/common": enUSCommon, 18 "en-US/settings": enUSSettings, 19 "pt-BR/common": ptBRCommon, 20 "pt-BR/settings": ptBRSettings, 21 "es-ES/common": esESCommon, 22 "es-ES/settings": esESSettings, 23 "zh-Hant/common": zhHantCommon, 24 "zh-Hant/settings": zhHantSettings, 25 "fr-FR/common": frFRCommon, 26 "fr-FR/settings": frFRSettings, 27}; 28 29export async function loadTranslationData( 30 locale: string, 31 namespace: string, 32): Promise<any> { 33 // Map base language codes to full locales 34 const fullLocale = locale.includes("-") 35 ? locale 36 : { 37 en: "en-US", 38 pt: "pt-BR", 39 es: "es-ES", 40 zh: "zh-Hant", 41 fr: "fr-FR", 42 }[locale] || locale; 43 44 const localeNamespaceKey = `${fullLocale}/${namespace}`; 45 const translations = translationMap[localeNamespaceKey]; 46 47 if (!translations) { 48 throw new Error(`No translation mapping for ${localeNamespaceKey}`); 49 } 50 51 if (!translations || Object.keys(translations).length === 0) { 52 throw new Error("No translations found"); 53 } 54 55 return translations; 56}