Next-translate: Migrating to v1.0.0

Created on 25 Nov 2020  路  7Comments  路  Source: vinissimus/next-translate

I've just updated to 1.0.0-experimental.15 and was looking for a migration guide. I couldn't find one so I wanted to open this issue to discuss whether you might want help with that. Here's a quick draft of steps I had to take in my project:

  1. Run npm install [email protected]
  2. Update next.config.js:
-const { locales, defaultLocale } = require("./i18n.json");
+const nextTranslate = require("next-translate");

module.exports = {
-  i18n: { locales, defaultLocale },
+  ...nextTranslate(),
};
  1. Remove unnecessary configuration from i18n.json:
{
  "locales": ["de", "fr", "it"],
  "defaultLocale": "de",
-  "currentPagesDir": "pages_",
-  "finalPagesDir": "pages",
-  "localesPath": "locales",
  "pages": {
    "*": ["common"],
    "rgx:^/products": ["products"]
  }
}
  1. Remove build step in package.json:
"scripts": {
-  "dev": "next-translate && next dev",
-  "build": "next-translate && next build",
+  "dev": "next dev",
+  "build": "next build",
  "start": "next start"
}
  1. Remove .gitignore entry
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

-# i18n
-/pages
  1. Move pages from pages_ to pages:
rm -rf pages
mv pages_ pages

Most helpful comment

I did a short demo video about 1.0:

I hope you find this useful 馃槉

_(sorry my English)_

All 7 comments

@dislick thank you very much to share this. Yes, the migration guide has yet to be written (as it is still experimental). Everything went well for you, no problems?

Another breaking change introduced by 1.0.0-experimental.16 is to change the plurals _plural by _other. Since now we have expanded the plural forms support, adapted to http://cldr.unicode.org/index/cldr-spec/plural-rules

Besides, the dynamic property of DynamicNamespaces component is now optional.

What I have done is to update the README of the experimental branch: https://github.com/vinissimus/next-translate/blob/1.0.0-experimental/README.md maybe this helps.

Another thing that is still pending is to update the repo examples. I wanted to do it just today.

If everything goes well, in a few days I will pass the version from experimental to canary, since it has that it looks that finally we will stay with this change.

Updating went great, no problems whatsoever! Yes I saw the new README on the experimental branch, thanks to that I was able to come up with the necessary steps to upgrade.

If you're interested I can open a PR with a migration guide, just tell me if you want it in the README or a separate file. I think you would then need to complete it with the plurals changes, but it might be a good starting point.

It's really a joy to use next-translate, please keep up the good work!

Updating to 1.0.0-experimental.16 went great too.

@dislick this will be awesome! 馃檹. I had in mind to extend the documentation in the future, documents like FAQ.md, and integrations like with-mdx.md, etc. So maybe it makes sense to put everything under the /docs directory. Perhaps /docs/migration-guide-1.0.0.md (or something like this) ?

Can someone who has windows confirm that it works well in the development environment?

I did a short demo video about 1.0:

I hope you find this useful 馃槉

_(sorry my English)_

Closing this. Already added on 1.0.0-canary.1. The 1.0 will be released in approximately 1-2 weeks. 馃槉. Feel free to open PR in order to fix issues, typos or improve documentation / migration guide

Was this page helpful?
0 / 5 - 0 ratings