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

Cannot display 0 in FormattedMessage #561

Closed
iamsaksham opened this issue Aug 1, 2016 · 1 comment
Closed

Cannot display 0 in FormattedMessage #561

iamsaksham opened this issue Aug 1, 2016 · 1 comment

Comments

@iamsaksham
Copy link

I want to display size of the list in the FormattedMessage, so I used values to achieve it. It works good but it dont show 0 as a value. I have a reduced test case below:

import React, { Component } from 'react'
import {FormattedMessage} from 'react-intl'

class List extends Component {

  render() {

    let userNumber=0; //if I change it to negative or positive value, it is displayed but 0 is not displayed
    return (
          <FormattedMessage
            id = 'active-users'
            description = 'ACTIVE USERS'
            defaultMessage = 'ACTIVE USERS ({userList})'
            values = {{
              userList: userNumber
            }}
          />
     )
  }
}
export default List
@iamsaksham
Copy link
Author

<FormattedMessage
    id = 'active-users'
    description = 'ACTIVE USERS'
    defaultMessage = 'ACTIVE USERS ({userList, number})'
    values = {{
      userList: userNumber
 }}/>

This needs to be done, documentation needs to be improved a bit.

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

1 participant