Skip to content
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

Trans should not generate <1></1> for <br /> and <p> #264

Open
tkrotoff opened this issue Mar 3, 2021 · 9 comments
Open

Trans should not generate <1></1> for <br /> and <p> #264

tkrotoff opened this issue Mar 3, 2021 · 9 comments

Comments

@tkrotoff
Copy link

tkrotoff commented Mar 3, 2021

To Reproduce

function Test() {
  const { t } = useTranslation();

  return (
    <Trans t={t}>
      hello
      <br />
      world
    </Trans>
  );
}
i18next Test.ts

i18next-parser generates:

{
  "hello<1></1>world": "salut<1></1>monde",
}

i18next in debug mode reports:

i18next::translator: missingKey fr translation hello<br/>world hello<br/>world

Expected behavior

i18next-parser should generate instead:

{
  "hello<br/>world": "salut<br/>monde",
}

More

<p> does not work too: i18next-parser should generate hello<p>world</p> instead of hello<1>world</1>.

Funny: <small> generates hello<1>world</1> and it works with i18next!!

There is definitely something wrong with i18next and i18next-parser formats: they should be the same.

Your Environment

  • runtime version: node 12, Firefox 86 & Chrome 88
  • i18next version: i.e. 19.9.1
  • i18next-parser version: 3.7.0
  • react-i18next version: 11.8.8
@karellm
Copy link
Member

karellm commented Mar 3, 2021

It might be related to #254

I'm not using react and I'm mostly maintaining this project because many rely on it. If you want to submit a PR, I will review and merge it!

@igorsantos07
Copy link

igorsantos07 commented Sep 3, 2021

Yep, that seems to still be a bug under i18next-parser 4.3.0. I wonder if the parser should follow the settings for the 18next?

Setting => transKeepBasicHtmlNodesFor: ['p', 'br', 'strong', 'b', 'i', 'em', 'u', 'tt', 'label']
Interface has => [...] <span className="text-nowrap">Use <tt>0</tt> to disable</span>
i18next reports =>      [...] <1>Use <tt>0</tt> to disable</1>. 
i18next-parser writes => [...] <1>Use <1>0</1> to disable</1>.

Indexing seems odd at first glance, but I guess it's 1 and 1 because they're nested?

The workaround currently is to disregard this neat option with transSupportBasicHtmlNodes: false. It works fine (even the 1 and 1 tags work, still showing that way).


Btw, if the project is solely depending on external PRs, I wonder if it would be better to remove the "gold sponsor" ad in the README? I mean, it seems they're neither sponsoring maintenance nor caring themselves for the project, even though it's under their org...

@karellm
Copy link
Member

karellm commented Sep 4, 2021

@igorsantos07 Yes ideally it should follow the settings from i18next.

For your other question: I'm not affiliated to i18next and this project is under their organization only to make it easier for people to find. That said, they were kind enough to offer a small monthly contribution. On a personal note, I don't even use this project anymore but I only maintain this project because it is used quite a lot. I've never done this for the money and the sponsorship doesn't come close to pay for the hundreds of hours spent on this project. Yet I will not remove the mention to it because I'm grateful for their contribution. Rather than criticizing the sponsorship of other, I believe a more productive question would be how can you contribute (with you time or financially) in order to have more work done on this project.

@igorsantos07
Copy link

igorsantos07 commented Sep 4, 2021 via email

@jamuhl
Copy link
Member

jamuhl commented Sep 4, 2021

@igorsantos07 I'm not sure what you like to achieve? On one hand, you are crying around open source is broken by not having enough maintained modules. On the other hand, you're pointing around our organisation does no free support or not enough. @adrai and I do quite a lot to keep i18next and react-i18next running and in a way, it will run in the next years coming too.

i18next is feature stable (proven over the years) and therefore new features needed by minorities are added carefully to not further bloat the project size.

You say it's tiring - but the fact is i18next runs now for over 10 years - and is even more or less API compatible with the v1. Give me any other module of this size that has achieved this. Believe me I gone through all the react-routers, react state managements with their ever-changing APIs every few months.

If you don't like i18next or locize...there are other options around...that easy. Perhaps you just have the wrong picture of the size of our company...

If you think you're able to change the i18next organisation to a cohesive group of developed projects - I'm open to letting you prove it...

@igorsantos07
Copy link

igorsantos07 commented Mar 11, 2022

@jamuhl Could not help but laugh at your mention of react-routers (emphasis on the plural) and the likes. Definitely can relate lol
I left the issue alone since I saw nothing was going to be fixed, and ended up never seeing the response on the side-topic.

The thing is: the message passed by being under an Org and being a sponsored project isn't what really happens. And I understand why all that, but still it's not clear these projects are in PR-only mode. You come in for the battle-tested and 10yo stability, but end up finding a couple of bugs here and there that almost get a "wontfix" label.

I don't need to prove anything, nor change something from the outside. What I can do is show what's visible from the outside, from a newcomer's point of view: there is slight incoherence in a sponsored project being PR-only. One would expect sponsored projects to be actively looked into, instead of getting "we're open to PRs" on bug reports. Since this is really the case, this should be clear from the readme and docs, stating the project is sort of stale.


On the main topic though, I came back because it bite me again. My suggestion created a nasty side-effect, which I guess is better suited to another issue.

@adrai
Copy link
Member

adrai commented Mar 12, 2022

@jamuhl Could not help but laugh at your mention of react-routers (emphasis on the plural) and the likes. Definitely can relate lol I left the issue alone since I saw nothing was going to be fixed, and ended up never seeing the response on the side-topic.

The thing is: the message passed by being under an Org and being a sponsored project isn't what really happens. And I understand why all that, but still it's not clear these projects are in PR-only mode. You come in for the battle-tested and 10yo stability, but end up finding a couple of bugs here and there that almost get a "wontfix" label.

I don't need to prove anything, nor change something from the outside. What I can do is show what's visible from the outside, from a newcomer's point of view: there is slight incoherence in a sponsored project being PR-only. One would expect sponsored projects to be actively looked into, instead of getting "we're open to PRs" on bug reports. Since this is really the case, this should be clear from the readme and docs, stating the project is sort of stale.

tldr;

  • i18next is not a real organization or company, it's a github organization: https://github.com/i18next
  • 10yo stability is for i18next (https://github.com/i18next/i18next), not for all i18next related modules
  • Regarding sponsoring: at least there is a bit of sponsoring. I don't think it would be better without any sponsoring?
  • A bit of history:
    1. i18next library was created by @jamuhl
    2. community extended the ecosystem, i.e. i18next-parser
    3. i18next creators created locize (also to fund the i18next library maintenance) - the question was "keep it in PR only mode"/deprecate it or try to find some funding
    4. locize tries to "say thank you" to some of the i18next projects created by the community by sponsoring them
  • All open source related work for i18next was and is done during our free time. Do you know what it means to maintain an open source project? A lot of time (not only coding, issues, Stackoverflow, docs, tutorials, etc.) is invested.
  • At the end: if you're not happy with i18next, I hope nobody forces you to use it, so you can pick something that suits more your expectations.

Solutions?
So what could be possible solutions to optimize the situation of i18next-parser? Since @jamuhl @karellm and I are not using i18next-parser personally, who wants to contribute?
How much money/time is needed so these i18next-parser "issues" could be addressed?
Is someone able to create an estimation/offer?

@karellm
Copy link
Member

karellm commented Mar 12, 2022

@adrai I'm still coding and fixing things for this project. Yet I'm at a different place in my life today and my priorities are organized differently. It means that it will evolve slowly when I can afford to put some time on it.

If someone need things fixed faster, one way would be to give a financial contribution. I've never received such a proposition in this project (beside the welcomed sponsorship) but I'm willing to discuss it. Another way is to open PRs and invest the necessary time to improve the project collaboratively, I'd be happy to open a maintainer sit if anyone feels the calling.

@LuisHerrero92
Copy link

LuisHerrero92 commented Jun 9, 2022

This is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants