Skip to content

Unexpected parenthesis in linked translations with enums #181

Closed
@DaleLaw

Description

Describe the bug
When using a linked translation in conjunction with an enum linked translation, the former unexpectedly generates parentheses. This leads to a syntax error in the strings.g.dart file, preventing it from being compiled.

hello: "Hello"
gender(context=Gender): {
  male: "male",
  female: "female"
}
hello_gender: "@:hello, @:gender"

strings.18n.yaml

String get hello => 'Hello';
String gender({required Gender context}) {
  switch (context) {
    case Gender.male:
      return 'male';
    case Gender.female:
      return 'female';
  }
}
String hello_gender({required Gender context}) => '${_root.hello()}, ${_root.gender(context: context)}';

strings.g.dart

Expected behavior
It should generate _root.hello instead of _root.hello()

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions