-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Fix tag converting behavior to match with react-i18next #665
base: master
Are you sure you want to change the base?
Conversation
572335b
to
a8880f7
Compare
@yoo2001818 |
No, it is You have to match them, either by setting i18next's value to |
As far as i can see, i18next-parser does not have |
i18next-parser does have You may use it like this: // i18next-parser.config.js
export default {
lexers: {
jsx: [{
lexer: 'JsxLexer',
transSupportBasicHtmlNodes: true,
}],
},
}; Furthermore, i18next-parser cannot read i18next's config, as i18next-parser statically analyzes the code without executing it. It doesn't actually care about i18next's configuration or its presence - it works by just reading However, i18next itself, does set |
d72e758
to
10f3d69
Compare
Bumped into this today and was so grateful to find not only is it reported, but there's a PR already. Could this be looked at by a maintainer? |
Why am I submitting this PR
This PR is continuation of #663. (You can disregard #663 if this PR gets merged first)
I've checked the difference between react-i18next and i18next-parser, and mainly there were 3 problems.
<br />
is converted to<br />
(should be<br/>
)<strong></strong>
should be converted to<strong/>
in this case. This directly contradicts Outputting autoclosed tags when there's no child content #254, so I think I need your decision whether to strictly follow react-i18next's behavior, or to allow some differences.elementName
when only 1 string element is inside the node.For example,
<p>a{'b'}</p>
is converted to<1>ab</1>
because there are two string elements inside<p>
.<p>{{ count }}</p>
is also converted to<1>{{ count }}</1>
because the children is an object.This resolves 1st and 3rd point to match with react-i18next's behavior.
I think #264 can be resolved if this PR gets merged, and
transSupportBasicHtmlNodes
becomestrue
by default. However, since that would be a breaking change, a proper documentation abouttransSupportBasicHtmlNodes
could be enough to resolve it. I'll try to update the documentation if you want to.Does it fix an existing ticket?
No
Checklist
yarn test
(see details here)