Skip to content

ARB placeholder types not compatible with Flutter localizations #3

Open
@msonntag13

Description

@msonntag13

As per a commit in the Flutter localizations tool from November 2024, it is now preferred (effectively enforced) to match ARB placeholder types between all languages. Means if there's a template ARB file with defines a placeholder, all other ARB files must include and match that placeholder.

However, using the Localizely CLI, a pull command would automatically populate the placeholders in all files, but not their types. E.g.:

template_arb_file

  "someTranslation": "With some {placeHolder}",
  "@someTranslation": {
    "placeholders": {
      "placeHolder": {
         "type": "String"
      }
    }
  }

Would become this in any other languages ARB file:

  "someTranslation": "Another language {placeHolder}",
  "@someTranslation": {
    "placeholders": {
      "placeHolder": {}
    }
  }

Which leads to the following error when flutter gen-l10n is executed:

The placeholder, type, has its "type" resource attribute set to the "null" type in locale "<OTHER_LANGUAGE>", 
but it is "String" in the template placeholder. For compatibility with template placeholder, 
change the "type" attribute to "String".

This also happens if no specific type is defined in the template ARB file, in this case complaining about null (in other language) not matching Object from template ARB.

Is there any way around this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions