Skip to content

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

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

Closed
alexobviously opened this issue Sep 14, 2021 · 6 comments
Labels
P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@alexobviously
Copy link

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?

@alan-knight
Copy link
Contributor

The parsing would be in intl_translation, not this package. And it should understand "one", at least it's in the grammar. So there's probably something more complicated going on. Note that it's possible to add your own parsing if you need to work around issues or use a different format. See intl_translation_format.

@aleksakrstic
Copy link

Here is the issue I created for Flutter repo: flutter/flutter#84291

@alan-knight
Copy link
Contributor

Yes, but I don't think that's the same issue. See also #215

@alexobviously
Copy link
Author

The parsing would be in intl_translation, not this package. And it should understand "one", at least it's in the grammar. So there's probably something more complicated going on. Note that it's possible to add your own parsing if you need to work around issues or use a different format. See intl_translation_format.

I'm not using intl_translation, I'm only using intl with the flutter: generate: true option and a l10n.yaml

@mosuem mosuem added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P3 A lower priority bug or feature request labels Oct 12, 2022
@mosuem
Copy link
Member

mosuem commented Nov 16, 2022

Closing in favor of #215 and/or the flutter issue.

@mosuem mosuem closed this as not planned Won't fix, can't repro, duplicate, stale Nov 16, 2022
@alexobviously
Copy link
Author

alexobviously commented Nov 17, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 A lower priority bug or feature request type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants