Reputation: 689
I want to add a dynamic language based on API. In API I get list of languages and I should have route prefix for each language except en.
for example:
en:
https://mynuxt.com/hotel/paris-hotel
de:
https://mynuxt.com/de/hotel/paris-hotel
and ...
How should I generate my dynamic routes? and languages are dynamic.
Upvotes: 2
Views: 2440
Reputation: 11437
This is an example on how to create the folder structure to provide the desired router path:
pages/
--| _lang/
-----| hotel/
-------| paris-hotel/
---------| index.vue
--| hotel/
----| paris-hotel/
------| index.vue
Then you can import a view into both index.vue
to avoid duplicating logic. Ofcourse, I could be more of a help if your provided an example of what you have tried so far.
Upvotes: 1