const { t } = useI18n()
getCurrentInstance
import { getCurrentInstance } from 'vue'
export function useI18n() {
const instance = getCurrentInstance()
if (!instance) return (localeString: string) => localeString // вернем строку обратно
return instance.appContext.config.globalProperties.$t
}
<script setup lang="ts">
import useI18n from '@/utils/useI18n'
const t = useI18n()
</script>