import { reactive, toRefs, watchEffect } from 'vue' import { useI18n } from 'vue-i18n' export function useStoreI18n(options) { const { t, locale } = useI18n(options) const keyMap = reactive({}) function $$t(...key) { watchEffect(() => { if (locale.value) keyMap[key] = t(...key) }) return toRefs(keyMap)[key] } return { $$t } }