victorgarciaesgi / nuxt-typed-router

🚦Provide autocompletion and typecheck to Nuxt router
https://nuxt-typed-router.vercel.app
MIT License
361 stars 12 forks source link

feat: add support for nuxt link locale from i18n #124

Closed UfukUstali closed 11 months ago

UfukUstali commented 1 year ago

For the types for the NuxtLinkLocale component to be generated correctly this module needs to be loaded after the i18n module. This is because of how we detect if this component exists in th first place. (see module.ts file)

I did try the following to avoid this:

Conditional generation and/or declaration of the types is required because this component was introduced on July 31. in the v8.0.0-rc.1 relase. If it is fine to include the types by default then all of the above can be safely ignored and changes can be made accordingly.

vercel[bot] commented 1 year ago

Someone is attempting to deploy a commit to a Personal Account owned by @victorgarciaesgi on Vercel.

@victorgarciaesgi first needs to authorize it.

victorgarciaesgi commented 1 year ago

Thanks for the PR @UfukUstali ! Must not have been easy to navigate the code as it's a bit of a mess 😅 . Just by looking at it it looks very good, i'll test it on my side. Just to understand, the <NuxtLinkLocale to='/foo' locale='fr'/> is like a shortcut to <NuxtLink to='toLocalePath('/foo', 'fr')'/> ?

victorgarciaesgi commented 1 year ago

Also do you mind trying to add unit type tests? :) Either on test/fixtures/complex/tests/i18n or test/fixtures/complex/src/pages/index.vue!

victorgarciaesgi commented 1 year ago

Upgraded the workflow engine to node 18, you can rebase for the tests to run

UfukUstali commented 1 year ago

So I did try to get tests to work but upgrading the the \@nuxtjs/i18n to a version that has the NuxtLinkLocale component broke other parts, mainly vueI18n configuration had to be in it's own file now and NuxtI18nOptions type was not exported anymore. (I still don't know how to fix the latter).

victorgarciaesgi commented 1 year ago

I do not have much time until next week, I'll keep you updated

UfukUstali commented 11 months ago

resolved with #128