{"version":3,"file":"translate-DqbXE_2p.js","sources":["../../../app/frontend/src/shared/components/LocaleSelector.vue","../../../app/frontend/src/shared/components/claims/CreateContinueClaimDialog.vue","../../../app/frontend/src/shared/views/ContactSubscriptions.vue","../../../app/frontend/src/shared/utils/translations.js","../../../app/frontend/src/shared/directives/translate.js"],"sourcesContent":["\n\n\n","\n\n\n","\n\n\n","/* eslint-disable no-param-reassign */\nimport Api from '@/shared/services/all_bright_finder';\n\nasync function getTranslatedText(inputText, i18n) {\n const { fallbackLocale, locale, messages, t } = i18n;\n\n // return if locale is 'en' or 'en-US' (fallback)\n if (locale.value === 'en' || locale.value === fallbackLocale.value) return inputText;\n // we already have an i18n translation if the 'i18n.messages' either:\n // 1. includes a key (for english) or\n // 2. includes a value (for anything other than english)\n // ...that matches the input text\n const hasExistingTranslation =\n Object.keys(messages.value).length > 0 &&\n !!messages.value[locale.value] &&\n (Object.keys(messages.value[locale.value]).includes(inputText) ||\n Object.values(messages.value[locale.value]).includes(inputText));\n if (hasExistingTranslation) return t(inputText);\n\n // If locale is not english and there is no local translation,\n // fetch translated text from backend\n const translationResp = await Api.translations.translate(inputText, locale.value);\n return translationResp?.value || inputText; // always fall back to english\n}\n\nexport { getTranslatedText };\n","/* eslint-disable no-param-reassign */\nimport { getTranslatedText } from '@/shared/utils/translations';\nimport i18n from '@/plugins/i18n';\n\nconst translate = async (el, binding) => {\n const inputText = binding.value;\n const translated = await getTranslatedText(inputText, i18n.global);\n el.innerHTML = translated;\n};\n\nexport default translate;\n"],"names":["i18n","useI18n","store","useStore","vuetify","useLocale","fetchedLocales","ref","selectedLanguage","computed","value","language","selectedLocale","lang","assets","locale","setCustomTranslations","getAriaLabel","text","replaceLiquid","messagesWithLiquid","messages","key","replacedKey","replacedValue","switchLocale","resp","Api","translationKeyValue","messagesWithLiquidReplacement","baseMessagesWithLiquidReplacement","baseLocales","props","__props","__expose","open","emit","__emit","eventBus","useEventBus","route","useRoute","router","useRouter","updateQuery","useRouterHelper","claim","claimAttachments","processing","schema","visible","claimSchemaId","_a","questionsLoaded","validateAnswers","validQuestions","useQuestionable","section","stepBack","stepForward","transitionName","useStepper","loaded","claimRepository","attachmentRepository","backFromQuestion","currentIndex","save","close","forwardFromQuestion","submitClaim","queryParams","loadAttachments","claimId","setClaim","params","t","instance","getCurrentInstance","role","contact","email","load","onMounted","getTranslatedText","inputText","fallbackLocale","translationResp","translate","el","binding","translated"],"mappings":"2fA+CA,MAAMA,EAAOC,EAAS,EAChBC,EAAQC,EAAU,EAClBC,EAAUC,GAAW,EACrBC,EAAiBC,EAAI,CAAC,IAAI,CAAC,EAE3BC,EAAmBC,EAAS,IAAM,CACtC,MAAMC,EAAQV,EAAK,OAAO,MAAM,MAAM,GAAG,EAAE,CAAC,EAE5C,MAAO,CADME,EAAM,MAAM,UAAU,KAAMS,GAAaA,EAAS,QAAUD,CAAK,CAClE,CACd,CAAC,EAEKE,EAAiBH,EAAS,IAAM,CACpC,MAAMC,EAAQV,EAAK,OAAO,MAAM,MAAM,GAAG,EAAE,CAAC,EACtCa,EAAOC,GAAO,OAAO,QAAQ,KAAMC,GAAWA,EAAO,QAAUL,CAAK,EAC1E,OAAKJ,EAAe,MAAM,SAASI,CAAK,GACjCM,EAAsBN,CAAK,EAG3BG,EAAK,OAASA,EAAK,IAC5B,CAAC,EAED,SAASI,EAAaC,EAAM,CAC1B,MAAO,GAAGlB,EAAK,EAAE,iBAAiB,CAAC,KAAKA,EAAK,EAAEkB,CAAI,CAAC,EACtD,CAEA,SAASC,EAAcC,EAAoB,CACzC,MAAMC,EAAW,CAAE,GAAGD,CAAoB,EAC1C,cAAO,KAAKC,CAAQ,EAAE,QAASC,GAAQ,CACrC,MAAMC,EAAcD,EAAI,QAAQ,MAAO,IAAI,EAAE,QAAQ,MAAO,IAAI,EAC1DE,EAAgBH,EAASC,CAAG,EAAE,QAAQ,MAAO,IAAI,EAAE,QAAQ,MAAO,IAAI,EAC5ED,EAASE,CAAW,EAAIC,CAC5B,CAAG,E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