shopware/meteor

[Bug]: <SwDataTable /> component i18n messages cannot be resolved

Closed this issue · 2 comments

Package

@meteor/component-library

Package version

3.0.0-alpha1

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-ywaatz?file=src%2FApp.vue

Steps to reproduce

  1. Setup a running environment as seen in the StackBlitz project with Vue 3 and i18n plugin for the translations
  2. Add the <SwPagination /> and <SwDataTable /> component

Actual behavior

  1. With inactive i18n legacy mode in main.js both components can be rendered. However, the translations are not resolved for both components
  2. With active i18n legacy mode in main.js the translations of the <SwPagination /> component resolve correctly. However, the <SwDataTable /> crashes, since it doesn't support legacy mode.

Expected behavior

There should be a i18n module config that supports correct translation functionality for all components of the library.

System Info

No response

Any additional comments?

No response

Code of Conduct

Hey @atloss, the code snippet below got it working for me. You need to enable the legacy mode and set the allowComposition property to true.

const i18n = createI18n({
  // Enable legacy mode
  legacy: true,
  locale: 'de',
  messages: {
    en: {
      hello: 'Hello world!',
    },
  },
  // Enable this
  allowComposition: true,
});

I hope this helps you.

Hi @Haberkamp,

got it working for me as well. Appreciate your help.

Thank you!