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

Bug with Trans component without children #84

Closed
SPAHI4 opened this issue Mar 27, 2018 · 5 comments
Closed

Bug with Trans component without children #84

SPAHI4 opened this issue Mar 27, 2018 · 5 comments

Comments

@SPAHI4
Copy link

SPAHI4 commented Mar 27, 2018

1.0.0-beta6
cli

I'm trying to use Trans component as self-closing tag.

<Trans i18nKey="Foo" />

CLI just do nothing without any error.

<Trans i18nKey="Foo"></Trans>

This works fine

@karellm
Copy link
Member

karellm commented Mar 27, 2018

Thanks for the bug report. I've just published 1.0.0-beta7 that address that issue.

@SPAHI4
Copy link
Author

SPAHI4 commented Mar 27, 2018

@karellm I still have this error on 1.0.0-beta7

@karellm
Copy link
Member

karellm commented Mar 28, 2018

@SPAHI4 Can you detail this please. Here is the test and the associated template file. A reproducible failing test case or more details would help.

@SPAHI4
Copy link
Author

SPAHI4 commented Mar 28, 2018

@karellm

the code below, templating/react.jsx

import React from 'react'
import { translate, Trans, Interpolate } from 'react-i18next'

const bar = () => (
  <div>
    <span><Trans i18nKey="bar"></Trans></span>
  </div>
);

const foo = () => (
  <div>
    <span><Trans i18nKey="foo" /></span>
  </div>
);

class Test extends React.Component {
  render () {
    const { t } = this.props
    return (
      <div>
        <h1>{t('first')}</h1>
        <Interpolate i18nKey="second" value="some thing" component={interpolateComponent} />
        <Trans i18nKey="third.first" count={count}>
            Hello <strong title={t('fourth')}>{{name}}</strong>, you have {{count}} unread message. <Link to="/msgs">Go to messages</Link>.
        </Trans>
        <Trans i18nKey="fifth" count={count} />
      </div>
    )
  }
}

export default translate('react')(Test)

test, look at foo value
image

karellm added a commit that referenced this issue Mar 29, 2018
@karellm
Copy link
Member

karellm commented Mar 29, 2018

Thanks, it helped. I just published 1.0.0-beta8 that should fix it for good.

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

2 participants