Skip to content

Support booleans and numbers as i18n content #342

@nank1ro

Description

@nank1ro

Describe the bug
slang doesn't support booleans

To Reproduce
Have a json file with something like

{"enabled": true}

Expected behavior
No errors, enabled returns the true value.

Additional context

Unhandled exception:
type 'bool' is not a subtype of type 'Map<String, dynamic>'
#0      _parseMapNode.<anonymous closure> (package:slang/src/builder/builder/translation_model_builder.dart:403:17)
#1      _LinkedHashMapMixin.forEach (dart:_compact_hash:765:13)
#2      _parseMapNode (package:slang/src/builder/builder/translation_model_builder.dart:287:8)
#3      TranslationModelBuilder.build (package:slang/src/builder/builder/translation_model_builder.dart:113:28)
#4      TranslationModelListBuilder.build (package:slang/src/builder/builder/translation_model_list_builder.dart:27:48)
#5      GeneratorFacade.generate (package:slang/src/builder/generator_facade.dart:18:62)
#6      generateTranslations (file:///Users/ale/.pub-cache/hosted/pub.dev/slang-4.11.0/bin/slang.dart:356:34)
<asynchronous suspension>
#7      main (file:///Users/ale/.pub-cache/hosted/pub.dev/slang-4.11.0/bin/slang.dart:174:7)
<asynchronous suspension>

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions