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

Enum of interfaces #271

Open
ziadsarour opened this issue Dec 12, 2024 · 0 comments
Open

Enum of interfaces #271

ziadsarour opened this issue Dec 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ziadsarour
Copy link

Motivation
It would be great to have an enum of interfaces.

Developer Experience
There are 2 options, the first one being the best one I guess :

en.json

"list(interface=MyInterface, context=MyEnum)": {
    "first": {
        "title": "The 1st one"
    },
    "second": {
        "title": "The 2nd one"
    }
}

or

"list(context=MyEnum)": {
    "first(interface=MyInterface)": {
        "title": "The 1st one"
    },
    "second(interface=MyInterface)": {
        "title": "The 2nd one"
    }
}

slang.yaml

interfaces:
    MyInterface: list.*

Current behavior
Currently, both are throwing this error :

Unhandled exception:
type 'ObjectNode' is not a subtype of type 'StringTextNode' in type cast
#0      _parseMapNode.<anonymous closure> (package:slang/src/builder/builder/translation_model_builder.dart:431:52)
#1      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#2      _parseMapNode (package:slang/src/builder/builder/translation_model_builder.dart:279:8)
#3      _parseMapNode.<anonymous closure> (package:slang/src/builder/builder/translation_model_builder.dart:384:20)
#4      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#5      _parseMapNode (package:slang/src/builder/builder/translation_model_builder.dart:279:8)
#6      TranslationModelBuilder.build (package:slang/src/builder/builder/translation_model_builder.dart:111:28)
#7      TranslationModelListBuilder.build (package:slang/src/builder/builder/translation_model_list_builder.dart:26:48)
#8      GeneratorFacade.generate (package:slang/src/builder/generator_facade.dart:18:62)
#9      generateTranslations (file:///Users/Ziad/.pub-cache/hosted/pub.dev/slang-4.3.0/bin/slang.dart:317:34)
<asynchronous suspension>
#10     main (file:///Users/Ziad/.pub-cache/hosted/pub.dev/slang-4.3.0/bin/slang.dart:141:7)
<asynchronous suspension>
@ziadsarour ziadsarour added the enhancement New feature or request label Dec 12, 2024
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

1 participant