jshmrtn / vue3-gettext

Translate Vue 3 applications with gettext.
https://jshmrtn.github.io/vue3-gettext/
MIT License
70 stars 24 forks source link

Messages in native <template> tags do not get extracted #21

Closed tcitworld closed 2 years ago

tcitworld commented 2 years ago

Versions:

The messages are not extracted in this configuration

<template>
  <router-link>
    <template v-if="mode === 'list'">{{ $gettext('Map') }}</template>
    <template v-else>{{ $gettext('List') }}</template>
  </router-link>
</template>

But this one works

<template>
  <router-link>
    <span v-if="mode === 'list'">{{ $gettext('Map') }}</span>
    <span v-else>{{ $gettext('List') }}</span>
  </router-link>
</template>

Possibly a limitation with Gettext Extractor itself, didn't check yet.

lzurbriggen commented 2 years ago

Yes, this seems to be a gettext-extractor issue that has to be fixed upstream. It's a bit weird that <template>{{ $gettext("TRANSLATETHIS2") }}</template> works but <template><template>{{ $gettext("TRANSLATETHIS2") }}</template></template> does not.

fjeddy commented 2 years ago

Same with composition API and setup, can't get anything to extract within it.

<script setup>
import { $gettext } from 'wherever'
$gettext('hello')
</script>
lzurbriggen commented 2 years ago

@fjeddy I finally found the time to look at that issue and managed to fix it. Release in 2.2.1.

This problem is separate from the <template> issue, I may not be able to fix that one in the near future.

lzurbriggen commented 2 years ago

@tcitworld I managed to fix this, released in 2.2.2.