Skip to content

Plural form with default message #140

Open

Description

@7nights

In the example you can use variables with defaultMessage like
intl.get('HELLO', { name }).d(`Hello, ${name}`); // "Hello, Tony". But is there anyway to get defaultMessage to work with locale template like
intl.get('HELLO', { num }).d("You have {num, plural, =0 {no photos.} =1 {one photo.} other {# photos.}}" )" }) . For example, maybe add a parameter to intl.get: intl.get(key, variables, defaultMessage) or you may need to do some refactoring to make it work with current apis.

Activity

  1. cwtuan commented on Sep 4, 2020

    @cwtuan
    Collaborator

    Currently, the defaultMessage is just support the ES6 string template.
    I will take this into consideration for next major release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions