Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting plugins to Vue (i18n) #33

Closed
XShep opened this issue Mar 13, 2023 · 5 comments
Closed

Connecting plugins to Vue (i18n) #33

XShep opened this issue Mar 13, 2023 · 5 comments

Comments

@XShep
Copy link

XShep commented Mar 13, 2023

Hello, i would like to connect the i18n translations to the ngVue. Tried a lot of examples, searching inside the main files. I saw that you did plugins functionality, but can you please explain how to use it, and connect for example i18n?

@jaredmcateer
Copy link
Owner

jaredmcateer commented Mar 13, 2023

Hi, It looks like it depends whether you're using composition api or options api in your code. Make sure you're using v9 of i18n.

If you're using Options api, instead of app.use(i18n), you need to call $ngVueProvider.use(i18n) as described in the Plugin/Use/Directives docs

If you're using Composition API it looks like i18n provides a composable that you can use to use in your setup functions (or script setup), so there should be no need to config ngVue at all for it.

@XShep
Copy link
Author

XShep commented Mar 13, 2023

Much thanks, i didn't found your documentation before. I'll close issue after successful tests.

@XShep
Copy link
Author

XShep commented Mar 13, 2023

Having problem with syntax, but in your example it is the same.
Saying me, that the : is unexpected in config of angular module

const ngVue = ngVue3.useNgVue();
const ngVuePlugins = ngVue3.useNgVuePlugins();

angular.module("vue.components", [ngVue, ngVuePlugins])
    .config(($ngVueProvider: NgVueProvider) => {
        $ngVueProvider.use(i18n);
    });

Maybe that happens because i'm importing without import statement? Btw ngVue works like that

@jaredmcateer
Copy link
Owner

Are you using TypeScript? If not remove : NgVueProvider. I should probably clarify that in the docs.

@XShep
Copy link
Author

XShep commented Mar 13, 2023

Yeah, thanks a lot for help! Now it works

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

No branches or pull requests

2 participants