Comments

Hardik_Patel_12 created an issue. See original summary.

hardik_patel_12’s picture

StatusFileSize
new2.52 KB

Kindly review a patch.

hardik_patel_12’s picture

Assigned: hardik_patel_12 » Unassigned
Status: Needs work » Needs review
naresh_bavaskar’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

There's usages of t() in

  • core/modules/views_ui/src/ViewAddForm.php
  • core/modules/views_ui/src/Form/Ajax/EditDetails.php
  • core/modules/views_ui/src/Form/Ajax/Rearrange.php
  • core/modules/views_ui/src/Form/Ajax/RearrangeFilter.php
  • core/modules/views_ui/src/Form/Ajax/ReorderDisplays.php

that can be converted to $this->t().

The usage in core/modules/views_ui/src/ViewUI.php can't be changed because this class is not injectable with services atm.

Also I suspect there is a meta issue for fixing all the usages of t() where appropriate that this should linked to and checked that it is following the scope agreed on that issue.

hardik_patel_12’s picture

StatusFileSize
new7.96 KB

Converted t() with $this->t() in more files of views_ui module.Kindly review a new patch.

hardik_patel_12’s picture

Status: Needs work » Needs review
naresh_bavaskar’s picture

Assigned: Unassigned » naresh_bavaskar
naresh_bavaskar’s picture

Assigned: naresh_bavaskar » Unassigned
Status: Needs review » Reviewed & tested by the community

Looks fine for me.

andypost’s picture

Status: Reviewed & tested by the community » Needs review
Parent issue: » #3113904: [META] Replace t() calls inside of classes
StatusFileSize
new7.19 KB
new14.5 KB

Created Meta issue as #5 suggested

Also fixed CS and replaced usage in core/modules/views_ui/src/ViewUI.php

xjm’s picture

Status: Needs review » Closed (duplicate)

Thanks for working on this.

In general, issues should not be scoped by file or module; instead, they should be scoped by making the exact specific change across as much of core as possible. Reference: https://www.drupal.org/core/scope#files

In particular, t() calls should be replaced based on whether the translation service is already available in the class, and more specifically, based on which base class it extends. (So, for example, one issue for form builders, one for controllers, one for list builders, and then splitting that up further only if the resulting patch is too large to be manageable.) We also need to decide the approach before we proceed with child issues. See #3113904: [META] Replace t() calls inside of classes for more discussion. So, closing as a duplicate of the parent issue in #3113904: [META] Replace t() calls inside of classes .

Thanks!