[V3] Migration should be done with a codemod?
See original GitHub issueIs your feature request related to a problem? Please describe. I found after writing the documentation there are several steps to migrate a large application:
- NumberFormat and DateFormat components were removed. Use
date
andnumber
formats from @lingui/core package instead. - Change import of components to
macro
fromreact
package - plural parameters changed:
- plural({ value, one: "# book", other: "# books" })
+ plural(value, { one: "# book", other: "# books" })
- i18n.t(), i18n.plural(), i18n.select() and i18n.selectOrdinal() methods are removed and replaced with macros.
- Rename
I18nProvider.defaultRender
prop toI18nProvider.defaultComponent
- Macros don’t need to be wrapped inside
i18n._
:i18n._(t'Message')
=>t'Message'
To not implement:
setupI18n
can be safely removed andi18n
can be imported from@lingui/core
(ifsetupI18n
has some parameters, I would leave it for user to handle it), this is a easily migration for the end user so probably it’s not the worth time to implement a codemod to this
Describe proposed solution I propose to write a codemod for do all this migration with a just
npx codemod lingui-v2-to-v3
the user only should migrate his i18n setup from a declarative API to the new i18n.load
, and i18n.activate
What do you think @tricoder42? Probably I could get it working tomorrow or the next, with this and the documentation finished we’ll have a good adoption.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Migrating Code Using Codemods - Medium
To do this, we're going to be using the following tools: JSCodeShift to apply our codemod to our codebase; AST Explorer to test...
Read more >Strapi v3 to v4 Migration Using Codemods [ Strapi ... - YouTube
strapiStrapi v3 to v4 Migration Using Codemods [ Strapi Migration Guide Part 2 ]This tutorial video will cover how to use codemods when ......
Read more >How To Migrate From Strapi v3 to v4 Walkthrough
This article will cover the "bird's view" of the Strapi v3 to v4 migration process. ... We need to do this before using...
Read more >Migrating your code to SDK for JavaScript V3
The experimental collection of codemod scripts in aws-sdk-js-codemod helps migrate your existing AWS SDK for JavaScript (v2) application to use v3 APIs.
Read more >Migrate From V6 to V7 - Simple React forms validation
This will info hook form that errors object is been subscribed. You can use this codemod library to speed up the process: https://github.com/react-hook-form/ ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@semoal I’ve invited you as a collaborator. Let me know if it enables write access for you