Fix 'Drupal.Semantics.FunctionT.NotLiteralString' coding standard
Closes #3123067
Merge request reports
Activity
- Resolved by quietone
- Resolved by Stephen Mustgrave
- Resolved by quietone
- Resolved by quietone
78 78 $query->fields('pf', ['name', 'title']); 79 79 $results = $query->execute(); 80 80 foreach ($results as $profile) { 81 // phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString 81 82 $fields[$profile['name']] = $this->t($profile['title']); 82 83 } - Comment on lines 80 to 82
This was added in the first patch in Migrate in Core: Drupal 6 to Drupal 8 back in 2014. There was no discussion or questions about translation.
- Resolved by quietone
- Resolved by quietone
- Resolved by Stephen Mustgrave
- Resolved by quietone
- Resolved by Stephen Mustgrave
- Resolved by Stephen Mustgrave
- Resolved by quietone
- Resolved by Stephen Mustgrave
- Resolved by quietone
206 206 protected function runTestQuery($query, $pass, $fail, $fatal = FALSE) { 207 207 try { 208 208 Database::getConnection()->query($query); 209 // phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString 209 210 $this->pass(t($pass)); 210 211 } 211 212 catch (\Exception $e) { 213 // phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString 212 214 $this->fail(t($fail, ['%query' => $query, '%error' => $e->getMessage(), '%name' => $this->name()])); - Comment on lines 208 to 212
I guess this is because we do not know the argument values when create the strings in \Drupal\Core\Database\Install\Tasks::
There was an error rendering this math block. KaTeX parse error: Undefined control sequence: \Drupal at position 137: …the strings in \̲D̲r̲u̲p̲a̲l̲\Core\Database\…tasks have ever been translated. It's not in German or Ukrainian - the top two translations on localize.drupal.orgI kinda feel we need a file that POTX can parse for strings that we know POTX will never extract.
- Resolved by quietone
added 31 commits
-
42e70026...1a487f3b - 28 commits from branch
project:11.x
- 2aaf8e3d - Add ignore lines
- bdba2b40 - accept suggestions
- b8b28edb - add comment
Toggle commit list-
42e70026...1a487f3b - 28 commits from branch
added 195 commits
-
b8b28edb...d135a79d - 191 commits from branch
project:11.x
- b09bd380 - Add ignore lines
- 4c3ffa8a - accept suggestions
- 4d663c8b - add comment
- 5fe4df47 - Add ignore for recent changes
Toggle commit list-
b8b28edb...d135a79d - 191 commits from branch
74 74 ); 75 75 76 76 // Pass the original string to the t() function to get it marked as safe. 77 // phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString 77 78 $safe_string = t($original_string); I think this does want to use t(). The test summary line is "Tests if a translated and tokenized string is properly escaped by Twig". The test itself was added in Strings including tokens in href or src attributes cannot be translated due to safeness check incompatibilities which is definitely about translation.
assigned to @quietone
unassigned @quietone
added 196 commits
-
5fe4df47...79a49040 - 192 commits from branch
project:11.x
- bc1fbfe4 - Add ignore lines
- 5c58fe13 - accept suggestions
- e9bf6e5f - add comment
- 9f3231dc - Add ignore for recent changes
Toggle commit list-
5fe4df47...79a49040 - 192 commits from branch