New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support i18next 22, react-i18next 12 and move both to peer-deps #1966
Merged
Merged
Changes from 19 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
43d7a83
chore(deps): update to i18next ^22.0.0
belgattitude 1653be1
chore: more react-i18next i18next to peer deps
belgattitude b82d6c2
docs: update installation for peer-dependencies
belgattitude 6ac538b
docs: added UPGRADING notes
belgattitude 40ce20d
docs: add upgrading
belgattitude 6819783
docs: update upgrade notes
belgattitude 310ed5a
Merge branch 'master' into update-i18next-22
belgattitude d96ced8
chore(deps): update example to react-i18next v12
belgattitude a103a0b
docs: changelog
belgattitude 394675c
Merge branch 'master' into update-i18next-22
belgattitude 2f64ff5
refactor!: drop export of Resources
belgattitude 3d06e5f
Merge branch 'master' into update-i18next-22
belgattitude dd35ecf
chore(deps): update to i18next 22.0.2
belgattitude a8a05cf
chore(peer-deps): remove range and min i18next to 22.0.2
belgattitude 1063789
feat(example): example on i18next new translation key
belgattitude 91467ac
fix(examples): restore current way for keys typing
belgattitude 46aba9a
Merge branch 'master' into update-i18next-22
belgattitude 0d873f9
docs: changelog and upgrading updates
belgattitude 98fe8bf
docs: rephrase
belgattitude c453ac2
Add @belgattitude as a contributor
belgattitude 4369cd1
Merge branch 'master' into update-i18next-22
belgattitude 062f4df
refactor: remove i18next type augmentation
belgattitude da82db5
Merge remote-tracking branch 'origin/master'
belgattitude 195fc49
Merge branch 'master' into update-i18next-22
belgattitude b37086c
revert: lost range during merges
belgattitude 1db5b73
Merge remote-tracking branch 'origin/master'
belgattitude b565be4
Merge remote-tracking branch 'origin/master'
belgattitude 5243ae9
Merge branch 'master' into update-i18next-22
belgattitude f94278d
chore(deps): update to i18next-fs-backend@^2.0.0
belgattitude File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Version 13.x | ||
|
||
Both `i18next` and `react-i18next` have been moved to [peerDependencies](https://github.com/npm/rfcs/blob/main/implemented/0030-no-install-optional-peer-deps.md) | ||
and must be installed part of `next-i18next`. When upgrading don't forget to add them to your dependencies: | ||
|
||
```bash | ||
npm install react-i18next i18next --save # NPM | ||
yarn add react-i18next i18next # Yarn | ||
pnpm add react-i18next i18next --save # PNPM | ||
``` | ||
|
||
This move was done in the hope to avoid issues regarding duplicates. See the | ||
[TROUBLESHOOT](https://github.com/i18next/next-i18next/blob/master/TROUBLESHOOT.md#multiple-instances) | ||
for more info. In the future it will also allow to support multiple ranges. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* If you want to enable locale keys typechecking and enhance IDE experience. | ||
* | ||
* Requires `resolveJsonModule:true` in your tsconfig.json. | ||
* | ||
* @link https://www.i18next.com/overview/typescript | ||
*/ | ||
import 'react-i18next' | ||
|
||
import type common from '../public/locales/en/common.json' | ||
import type footer from '../public/locales/en/footer.json' | ||
import type secondPage from '../public/locales/en/second-page.json' | ||
|
||
interface I18nNamespaces { | ||
common: typeof common | ||
footer: typeof footer | ||
'second-page': typeof secondPage | ||
} | ||
|
||
declare module 'i18next' { | ||
interface CustomTypeOptions { | ||
defaultNS: 'common' | ||
resources: I18nNamespaces | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrai testing upstream i18next 22 and types changes.
I tried to move the
declare module 'react-i18next'
todeclare module 'i18next'
, but actually it does not work (it's ignored). The currentdeclare module 'react-i18next'
still works perfect.I guess if we're going only to v22... we might have to change few things (outside of scope of this P/R)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe @pedrodurek can advice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rosskevin are you more familiar with next.js?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't use i18next and haven't been following specific changes closely. It's probably best for @pedrodurek to advise on the aspects of the custom types changes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
@adrai as it seems to work without the change. I propose to remove this file and finalize this pr. Can be done in a subsequent pr.
Wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean using the new i18next and react-i18next version but without the i18next.d.ts file?
If @pedrodurek can confirm this, yes.
I don't like to create another next-i18next major afterwards if this is not ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. just to bring some findings... I think it's safe though.
Existing types augmentations works and handled from react-i18next not next-i18next.
Totally fine to wait for me. Thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @belgattitude
You should change the import at the scope of the file, otherwise I won't re-export the other types from
i18next
.import 'i18next'
instead ofimport 'react-i18next'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pedrodurek Thanks, I did the change but still no luck.
I feel there's some more changes to do. I propose this:
You'll find explanations, issues where we can reproduce #1994.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll finish addressing some other issues that were reported and will look into it right after