Spittal / vue-i18n-extract

Manage vue-i18n localization with static analysis
https://pixari.github.io/vue-i18n-extract/#what-is-it
MIT License
312 stars 85 forks source link

Not working inside template literals when using composition API and SFC #158

Closed jan-thoma closed 2 years ago

jan-thoma commented 2 years ago

It looks like vue-i18n-extract is not working when it's used on inside template literals alongside with the composition API. For example:

<script setup>

import { useI18n } from 'vue-i18n'
import { computed } from '@vue/reactivity'

const { t } = useI18n()
const text = computed(() => `${t('PURCHASE_FOR')} 99$`)

</script>

Is reporting unused keys.

Spittal commented 2 years ago

I've found this to be the case in the large app that we're using this in internally. I've written a test case for this https://github.com/pixari/vue-i18n-extract/blob/master/tests/fixtures/vue-files/edge-cases.js#L15

I've also tested with the exact code you've posted and it looks like it's working now in the next release! Let me know if the newest release solves your issue!