WordPress / WordPress-Coding-Standards

PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions
MIT License
2.55k stars 483 forks source link

WordPress.WP.I18n.MissingTranslatorsComment for %d #2036

Open kkmuffme opened 2 years ago

kkmuffme commented 2 years ago

WordPress.WP.I18n.MissingTranslatorsComment should not report for %d placeholders, since %d is sufficiently specific for every translator to know it's a number

jrfnl commented 2 years ago

Thank you for raising this topic,

I do not agree with your assessment however, though I'm open to hearing more opinions.

since %d is sufficiently specific for every translator to know it's a number

  1. WordPress tries to be an open community to people of all skill levels. While experienced translators may know that %d signifies a number, beginner translators may not.
  2. While %d is always a number, what that number signifies can make a significant difference to how the "translation" is done, Consider the following examples:
    "Page %d" <= This is clear enough.
    "%1$d/%2$d/%3$d" <= This is absolutely unclear without a translators comment - is this mm/dd/yyyy ? yyyy/mm/dd ? etc
kkmuffme commented 2 years ago

1) this is true, but this is something you'd be able to figure out with 10 seconds of googling 2) true for multiple placeholders - however I meant to not report for %d only (= if there is only 1 placeholder)