You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Put the reproduction code into a view (aka SFC in the 'views' directory) and it will display the localized string as expected.
Put the exact same code into a component (aka SFC in the 'components' directory) that is then used inside a view and it will throw the following errors:
[intlify] Not found parent scope. use the global scope. [shared.mjs:159:16](http://localhost:5173/node_modules/vue-i18n/node_modules/@intlify/shared/dist/shared.mjs)
[intlify] Not found 'explanation' key in 'de-DE' locale messages. [shared.mjs:159:16](http://localhost:5173/node_modules/@intlify/core-base/node_modules/@intlify/shared/dist/shared.mjs)
[intlify] Fall back to translate 'explanation' key with 'de' locale. [shared.mjs:159:16](http://localhost:5173/node_modules/@intlify/core-base/node_modules/@intlify/shared/dist/shared.mjs)
[intlify] Not found 'explanation' key in 'de' locale messages.
So apparently the scope is based on the view?
If I leave the <i18n> block in the view and use the <template> in the component that is inside the view, it works. But to use the block that way doesn't make any sense.
Expected behavior
The <i18n> block should work in a component the same way it does in a view.
If the fact, that it does not, is by design, this should be explained in the docs.
Reproduction
<script setup lang="ts">
</script>
<template>
<div>
<i18n-t keypath="explanation" tag="p">
<template #reason>
<b>Some reason that comes from a variable</b>
</template>
</i18n-t>
</div>
</template>
<i18n>
{
"en-US": {
"explanation": "This happens because of {reason}."
},
"de-DE": {
"explanation": "Das passiert wegen {reason}."
}
}
</i18n>
Reporting a bug?
Vite is configured as stated in the docs: https://vue-i18n.intlify.dev/guide/advanced/sfc.html. My default locale is 'de-DE'.
Put the reproduction code into a view (aka SFC in the 'views' directory) and it will display the localized string as expected.
Put the exact same code into a component (aka SFC in the 'components' directory) that is then used inside a view and it will throw the following errors:
So apparently the scope is based on the view?
If I leave the
<i18n>
block in the view and use the<template>
in the component that is inside the view, it works. But to use the block that way doesn't make any sense.Expected behavior
The
<i18n>
block should work in a component the same way it does in a view.If the fact, that it does not, is by design, this should be explained in the docs.
Reproduction
System Info
Screenshot
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: