This repository was archived by the owner on Feb 22, 2026. It is now read-only.
Fix self-closing tag to match with react-i18next#663
Open
yoo2001818 wants to merge 1 commit intoi18next:masterfrom
Open
Fix self-closing tag to match with react-i18next#663yoo2001818 wants to merge 1 commit intoi18next:masterfrom
yoo2001818 wants to merge 1 commit intoi18next:masterfrom
Conversation
This was referenced Oct 24, 2022
d72e758 to
10f3d69
Compare
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Why am I submitting this PR
This PR corrects the behavior of
<br />to match with react-i18next's nodeToString routine.When
transSupportBasicHtmlNodesis true, inside<Trans>, react-i18next converts<br />into<br/>. But i18next-parser converts<br />into<br />, causing a difference between the defaultValue generated with each other.If
i18nKeyis specified, this wouldn't cause any problem because onlydefaultValuewould differ, and both<br/>and<br />can be parsed well by react-i18next.However, if only
defaultValueis specified, the defaultValue will be used as the i18nKey. Therefore it makes generated key and the actual key to mismatch, making react-i18next unable to find the translation entry.Does it fix an existing ticket?
No
Checklist
yarn test(see details here)FYI) I've encountered a failing test while running tests. I investigated the problem, and it turned out that
Intl.PluralRulesdefaults to the system language if an unknown locale is specified - so the test will fail if the system language is set to other languages that have more/less than 2 plural types.(
Intl.PluralRulesis used by i18next.PluralResolver.)The test can be successfully run by changing the system language to en-US: