Skip to content

Plurals using "one" not parsed, only "=1", Localizely generated files don't work properly #31

@alexobviously

Description

@alexobviously

So Localizely generates entries like this:

"people": "{count, plural, zero{} one{Person} other{People}}",
  "@people": {
    "placeholders": {
      "count": {}
    }
  },

and if I use that with intl, then I get generated code like this:

@override
String people(int count) {
  return intl.Intl.pluralLogic(
    count,
    locale: localeName,
    other: 'People',
  );
}

Note that it's missing the one field.

On the other hand, if I use this format:

"people": "{count, plural, =1{Person} other{People}",
  "@people": {
      "description": "",
      "placeholders": {
          "count": {}
      }
  },

it works fine, generating this code:

@override
String people(int count) {
  return intl.Intl.pluralLogic(
    count,
    locale: localeName,
    one: 'Person',
    other: 'People',
  );
}

It would be really nice if this package could understand this format. Right now I have to manually edit every arb file that Localizely creates, and that's really not scalable. Unless I'm mistaken, this format does seem to be part of the arb specification, so it should work - I assume this is a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requesttype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions