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

Support plurals in enums #124

Open
BenevidesLecontes opened this issue Jan 22, 2023 · 2 comments
Open

Support plurals in enums #124

BenevidesLecontes opened this issue Jan 22, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@BenevidesLecontes
Copy link

BenevidesLecontes commented Jan 22, 2023

Describe the bug
Im not able to generate translations using enums as params and pluralization.

"assetTypePlural(param=assetType)": {
      "stock": {
        "one": "{count} ação",
        "other": "{count} ações"
      },
      "stockIndex": {
        "one": "{count} índice",
        "other": "{count} índices"
      }
    }

Throws exception in this line:
digestedMap[entry.key] = entry.value as StringTextNode;

type 'PluralNode' is not a subtype of type 'StringTextNode' in type cast
package:slang/builder/builder/translation_model_builder.dart 328:52
@BenevidesLecontes BenevidesLecontes added the bug Something isn't working label Jan 22, 2023
@Tienisto Tienisto changed the title Enum as params + plural Support plurals in enums Jan 22, 2023
@Tienisto Tienisto added enhancement New feature or request and removed bug Something isn't working labels Jan 22, 2023
@Amphaal
Copy link

Amphaal commented Feb 13, 2023

This would be a great feature to add ! Looking forward to it :)

@Tienisto
Copy link
Member

The generated code will look quite complicated and I don't know a clean solution for that.

This technically implies, that you can nest any leaf with any other leaf. (Leaves are: String, RichText, Plural, Context (Enum))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants