Next-translate: Review loading namespaces

Created on 20 May 2020  路  3Comments  路  Source: vinissimus/next-translate

All 3 comments

After taking a closer look to the output I realized, that it's only loading additional namespaces for index routes, so it's not related to regex. This is my config:

{
  "allLanguages": ["en", "pt", "es"],
  "defaultLanguage": "es",
  "currentPagesDir": "pages_",
  "finalPagesDir": "pages",
  "localesPath": "public/locales",
  "defaultLangRedirect": "lang-path",
  "logBuild": false,
  "pages": {
    "*": ["common"],
    "/": ["forms", "account"],
    "/dashboard": ["analytics", "forms"],
    "/account/settings": ["forms", "account"],
    "/account/globalsettings": ["forms", "table", "account"],
    "/logout": ["forms", "account"],
    "rgx:/new$": ["forms", "table"],
    "rgx:/new-multi$": ["forms", "table"],
    "rgx:/import$": ["forms", "table"],
    "rgx:/\\[id\\]/edit$": ["forms", "table"],
    "/role/[id]": ["forms", "table"],
    "rgx:/\\[id\\]$": ["table", "analytics"],
    "rgx:/\\[id\\]/dashboard$": ["analytics"],
    "/inventory": ["table"],
    "/movement": ["table", "forms"],
    "/client": ["table"],
    "/supplier": ["table"],
    "/product": ["table"],
    "/transportagency": ["table"],
    "/user": ["table"],
    "/warehouse": ["table"],
    "/role": ["table"],
    "/invoicepdf": ["table"],
    "/import": ["table"],
    "/invoices": ["table"]
  }
}

Even routes like /dashboard where it's explicitly only for this route only receive the common namespace.

Routes like /movement on the other hand get their additional namespaces. The difference to /dashboard is, that /movement is an index.tsx file inside the movement folder, whereas /dashboard is just one file.

"/": ["forms", "account"], this one worked however, although that route is not in its own folder.

Removing "defaultLangRedirect": "lang-path", does not help.

@BjoernRave it should be fixed on 0.16.0-canary.7. Would be great if you can confirm 馃憦

It was introduced by a typo in a regex on https://github.com/vinissimus/next-translate/pull/163 . I added the failing test to cover this in the future.

@aralroca great news, I will give it a try :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BjoernRave picture BjoernRave  路  7Comments

mxmtsk picture mxmtsk  路  6Comments

popuguytheparrot picture popuguytheparrot  路  4Comments

yotovtsvetomir picture yotovtsvetomir  路  5Comments

dnepro picture dnepro  路  5Comments