Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Install the plugin without the new Vue #61

Open
gpessa opened this issue Feb 4, 2019 · 1 comment
Open

Install the plugin without the new Vue #61

gpessa opened this issue Feb 4, 2019 · 1 comment

Comments

@gpessa
Copy link

gpessa commented Feb 4, 2019

I have a Vue app.
And I have build a Vue plugin which contains all my UI component.
I would like that my UI plugin would also contain the i18n functionality.
Installing it it should add all my filters/component/directives and the i18n.
This is the code I would like to write:

let VueUi = Vue => {

  Vue.use(VueI18Next);

  i18next.init({
    lng: 'de',
    resources: {
      ...
    }
  });

  Object.values(Components).forEach(Component => {
    Vue.use(Component);
  });

  Object.values(Directives).forEach(Directive => {
    Vue.use(Directive);
  });

  Object.values(Filters).forEach(Filter => {
    Vue.use(Filter);
  });
};

The problem is that I get an error. I suppose because I miss this part:

new Vue({
  ...
  i18n: i18n,
});

Do I have a way to not write this code?

@alexmiddeleer
Copy link

This would be helpful for allowing translations in storybook as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants