-
Notifications
You must be signed in to change notification settings - Fork 124
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
Context app in types #30
Comments
@orblazer Did you add |
@kevinmarrec Yes but this is beacause nuxt-i18n add i18 with app.i18n and the context reference is Vue instance. |
@orblazer Alright but in which case do you need |
That is needed if you want use the i18n in middleware (like for get locale or some variables) |
Isn't |
@kevinmarrec i don't have the code under my hand but this is doesn't work beacause the app is not fully initialized. try to log context.app and you can see only "i18n" and not "$i18n". |
I know a bit of It's IMO a mess and if it would be for me, I would create new major version with this stuff cleaned up -- probably by only exposing But in any case, in current state of things at least, is it not fixable in Some more info here nuxt-modules/i18n#282 |
OK, I think I understand. So I guess defining |
Yes exactly @rchl |
@rchl @orblazer Are you talking about having a dedicated interface extending I'm pretty lost with all this stuff, I'm not mastering how
I'm not really sure if adding properties to But anyway, this thread should be IMO on dedicated /cc @paulgv |
@kevinmarrec this is not only for nuxt-i18n this is for all module whant add context app methods. |
Yes. The pros are:
Nothing really wrong with it. Official documentation has many examples with extending app and
Both refer to
That's true if decision is not to do dedicated interface in Nuxt. Fixing
|
I did some investigation on what |
What problem does this feature solve?
The problem is, when we use
context.app
we could not use (in nuxt-i18n) thecontext.app.i18n
, orcontext.app.$t
.This resolve the problem of types detection when use context.app.
What does the proposed changes look like?
We can probably use interface for that with name like
AppContext
.The text was updated successfully, but these errors were encountered: