Cannot access custom block messages / per-component translations
- Dominant language
- TypeScript
- Stars
- 204
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Hiya all, we would like to use per-component translations / a custom block in our Nuxt3 project:
- We have global `/locales` already in use.
- Vue Dev Tools shows the custom block `messages` but I cannot work out how to access them.
- I logged `@intlify/vite-plugin-vue-i18n/messages` and found the `messages` defined in `/locales` but nothing from the custom block.
Please find screenshots & snippets:
- vue dev tools

- `component.vue`
```vue
{
"en": {
"pageTitle": "Mission and Vision"
},
"de": {
"pageTitle": "Auftrag und Visionn"
}
}
import { useI18n } from 'vue-i18n'
import messages from '@intlify/vite-plugin-vue-i18n/messages'
const { t } = useI18n({
// `locale` inherit from global scope
inheritLocale: true,
})
console.log(messages)
```

- `nuxt.config.ts`
```js
intlify: {
localeDir: 'locales', // set the `locales` directory at source directory of your Nuxt application
vueI18n: {},
},
```
## Environment `npx nuxi info`
```
------------------------------
- Operating System: `Darwin`
- Node Version: `v16.14.0`
- Nuxt Version: `3.0.0-rc.1-27520426.ab3971d`
- Package Manager: `yarn@1.17.3`
- Builder: `vite`
- User Config: `buildModules`, `modules`, `css`, `build`, `vite`, `strapi`, `intlify`, `telemetry`
- Runtime Modules: `@intlify/nuxt3@0.2.2`, `@formkit/nuxt@1.0.0-beta.6`, `@nuxtjs/strapi@1.3.2-27565120.a6bd24b`
- Build Modules: `@vueuse/nuxt@8.3.1`
------------------------------
```
Contributor guide
Assessment
This issue has not been assessed yet.