The potx module does some amount of validation on t() calls and everything translatable. Right now, it detects 140+ errors while scanning Drupal 8 core.

This patch fixes some of those errors.
The rest are wrapper functions, potx false-positives (#2323545: improve potx validation), passing yaml data through t() calls (related: #2088371: YAML discovery incompatible with translations), or very hard to fix.

I also made a diff of the output errors in potx, before/after this patch.

Comments

Status: Needs review » Needs work

The last submitted patch, fix_t_calls.patch, failed testing.

herom’s picture

Status: Needs work » Needs review
StatusFileSize
new2.78 KB
new10.51 KB

update.

Status: Needs review » Needs work

The last submitted patch, 2: fix_t_calls-2323521-2.patch, failed testing.

Status: Needs work » Needs review

herom queued 2: fix_t_calls-2323521-2.patch for re-testing.

dawehner’s picture

Awesome work!

+++ b/core/modules/system/src/Tests/Form/FormTest.php
@@ -301,21 +301,32 @@ function testSelect() {
+    $no_texts = array(
+        $form['select']['#title'],
+        $form['select_required']['#title'],
+        $form['select_optional']['#title'],
+        $form['empty_value']['#title'],
+        $form['empty_value_one']['#title'],
+        $form['no_default_optional']['#title'],
+        $form['no_default_empty_option_optional']['#title'],
+        $form['no_default_empty_value_optional']['#title'],
+        $form['multiple']['#title'],
+        $form['multiple_no_default']['#title'],
+    );
+    foreach ($no_texts as $no_text) {
+      $this->assertNoText(t('!name field is required.', array('!name' => $no_text)));
+    }

We could even get rid of all the #title keys here and make it even easier.

herom’s picture

Issue summary: View changes
StatusFileSize
new2.26 KB
new10.31 KB

You are right.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

great!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 01372dd and pushed to 8.0.x. Thanks!

  • alexpott committed 01372dd on 8.0.x
    Issue #2323521 by herom: Fixed a couple of t() calls in core.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.