hozana / next-translate-routes

Flexible and translated routes for Next.js without custom server
MIT License
115 stars 30 forks source link

Duplication with routesTree #40

Closed nedimcimpohtec closed 2 years ago

nedimcimpohtec commented 2 years ago

I have crated routesTree and I have 2 urls /user - just user data /user/cards - user cards

So inside routesTree.json

{
      "name": "user",
      "paths": {
        "default": "user",
        "de": "benutzer",
      },
      "children": [
        {
          "name": "cards",
          "paths": {
            "default": "cards",
            "de": "karten"
          }
        }
      ]
    }

Now when I use link component and have link to user/cards translation is working fine but just for user is not working, only when I add new object for user without this children array

cvolant commented 2 years ago

You must add the index child among user children.

{
      "name": "user",
      "paths": {
        "default": "user",
        "de": "benutzer",
      },
      "children": [
        {
          "name": "index",
          "paths": {
            "default": "index"
          },
        },
        {
          "name": "cards",
          "paths": {
            "default": "cards",
            "de": "karten"
          }
        }
      ]
    }