Problem/Motivation
The singular and plural string parameters on Drupal.formatPlural() calls should be literal strings, plural containing a @count placeholder. At Drupal.formatPlural( $table.find('tr:visible') in js/block.admin.es6.js. Read more at http://drupal.org/node/323109
The string there is
Drupal.formatPlural(
$table.find('tr:visible').length - 1,
'1 block is available in the modified list.',
'@count blocks are available in the modified list.',
),
which is completely valid.
Steps to reproduce
Extract strings from core block module.
Proposed resolution
preg_match_all('~[^\w]Drupal\s*\.\s*(t|formatPlural)\s*\([^)]+\)~s', $code, $faulty_matches, PREG_SET_ORDER);
I guess we need to tokenize (AST?) this instead of using a regexp. Or at least parse the argument separators "," and not only the parenthesis "()"
Remaining tasks
TBD
User interface changes
TBD
API changes
TBD
Data model changes
TBD
Comments
Comment #2
gábor hojtsyThat may be valid, but we've not been supporting it. While it is possible to parse this, it does require a much more complex parsing solution that may be more error prone unless heavily automated-tested.
Comment #3
gábor hojtsyDoing an issue triage on potx now. This is actually a duplicate of #3630552: JavaScript strings potx does not find: trailing commas, null arguments, template literals, which is fixed in 3.x.
The cause was not the parentheses of the count argument,
$table.find('tr:visible').length - 1: 2.x currently extracts this call when there is no comma after the plural string. The cause was that comma at the. Since #3630552: JavaScript strings potx does not find: trailing commas, null arguments, template literals, 3.x accepts a comma after the plural string ofDrupal.formatPlural()and after the string ofDrupal.t(). 3.x extracts the strings of this call from the currentcore/modules/block/js/block.admin.jswithout errors: "1 block is available in the modified list." and "@count blocks are available in the modified list.".