Skip to content

Supporting plural with inconsistent templates #110

@MrOrz

Description

@MrOrz

I extracted a wording to POT file like this:

msgid "Do you want to eat this apple?"
msgid_plural "Do you want to eat these ${count} apples?"
msgstr[0] "你要吃這 ${count} 個蘋果嗎?"

In this example, the msgid and msgid_plural has inconsistent template placeholders.
The translation can be built by babel-plugin-ttag successfully, but it fails ttag-cli validate check:

msgid "Do you want to eat this apple?"
msgid_plural "Do you want to eat these ${count} apples?"
msgstr "你要吃這 ${count} 個蘋果嗎? <--- redundant count;"

According to the current logic it's checking the consistency between msgid and msgstr[0] (instead of msgstr[i] 🤔 ) for msgstr.length times.

I am wondering

  • If the inconsistent template placeholder is a valid pattern that should be supported by ttag-cli validate
  • If the pattern is valid, how could we adapt the logic to support such pattern?

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