slang-i18n / slang

Type-safe i18n for Dart and Flutter
https://pub.dev/packages/slang
MIT License
419 stars 36 forks source link

Support ARB placeholder types #214

Closed snipd-mikel closed 1 month ago

snipd-mikel commented 2 months ago

Motivation ARB files can already be used with slang, which allows to use the default Flutter format. However, the placeholder type is ignored when generating code

"nWombats": "{count} wombats",
  "@nWombats": {
    "placeholders": {
      "count": {
        "type": "int"
      }
    }
  }

Generates

String nWombats({required Object count}) => '${count} wombats';

We could use "nWombats": "{count:int} wombats" to specify the type, but that format is not supported by some tools and is not part of the ARB file format.

Developer Experience Support ARB placeholder type parameter.

Thanks for your work!

Tienisto commented 2 months ago

Slang currently normalizes all input formats into a common json format. I guess this is not respected in arb_decoder.dart yet

Tienisto commented 1 month ago

Added in v3.31.0