ttag-cli icon indicating copy to clipboard operation
ttag-cli copied to clipboard

Supporting plural with inconsistent templates

Open MrOrz opened this issue 5 years ago • 0 comments

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?

MrOrz avatar Nov 19 '20 08:11 MrOrz