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

trying to use vue-i18n #216

Closed
francoisp opened this issue Oct 17, 2019 · 8 comments · Fixed by #249
Closed

trying to use vue-i18n #216

francoisp opened this issue Oct 17, 2019 · 8 comments · Fixed by #249
Labels
bug Something isn't working

Comments

@francoisp
Copy link

francoisp commented Oct 17, 2019

Tried to use vue-i18n with vue-native-core, and when attempting use with

Vue.use(VueI18n);

I get this warning: [vue-i18n] vue-i18n (undefined) need to use Vue 2.0 or later (Vue: 0.1.4). Then when using $t() I get this error: [Vue warn]: Property or method "$t" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.

@RishabhKarnad
Copy link
Contributor

@francoisp This happens because the version of the Vue export from vue-native-core is generated from the package version, which at this point would be 0.1.4

We'll change this version number to the Vue.js version we forked from, in the next release. Since the version was ^2.0.0, the issue should be fixed then.

@francoisp
Copy link
Author

ok awesome! Where would I edit this to test locally?

FWIW I've also come across vuex-i18n, that one works with vue-native-core (also it uses vuex for lazy loading), but the rest of my stuff uses nuxt-i18n and that leverages vue-i18n... I'd like to use the same format for i18n in native and web artifact... At first glance vuex-i18n looks leaner and more flexible, but nuxt-i18n nails it for SSR as well as apps.

@RishabhKarnad
Copy link
Contributor

RishabhKarnad commented Oct 18, 2019 via email

@francoisp
Copy link
Author

thanks for the quick answer! I tried updating the Vue.version in the build file, but now I get

TypeError: undefined is not an object (evaluating 'i18n._t') 

vue-i18n seems a bit more integrated; I'm thinking I might just stick to translations in a json format instead of the fancy promise alternative that vue-i18n and nuxt-i18n offer; that way the same json files can be used for vuex-i18n...

@RishabhKarnad RishabhKarnad added the bug Something isn't working label Feb 24, 2020
@RishabhKarnad RishabhKarnad mentioned this issue Apr 18, 2020
@alexrok21
Copy link

excuse me, could someone integrate i18n to an a vue-native project? thanks

@doubleh311
Copy link

excuse me, could someone integrate i18n to an a vue-native project? thanks

I am using i18n-js for my vue-native_expo project and it could work as expectation. You can try it

@silianpan
Copy link

silianpan commented Jul 23, 2020

Vue.prototype._i18n = i18n must be under the line App.mpType = 'app'

App.mpType = 'app'
Vue.prototype._i18n = i18n

kazupon/vue-i18n#276 (comment)

@UsamaAltaf
Copy link

@doubleh311 How to use i18n-js in Vue Native project I can't be able to use i18n.t('')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants