Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pavan B S created an issue. See original summary.

Pavan B S’s picture

Assigned: Pavan B S » Unassigned
Status: Active » Needs review
FileSize
3.88 KB

Applying the patch, please review.

markdorison’s picture

Status: Needs review » Needs work

@Pavan B S: The patch in #2 throws exceptions. The classes you have modified to not use the StringTranslationTrait, so the t() method is not currently available. For an example of how to add it, see RecurlyJsLocalTask.

markdorison’s picture

Status: Needs work » Needs review
FileSize
4.35 KB

Re-rolled patch and updated with StringTranslationTrait as mentioned in #3.

Pavan B S’s picture

@markdorison, thanks for the help. I was finding for solution but i didn't get.

adamzimmermann’s picture

Status: Needs review » Needs work

This will need to be re-rolled after 2868491 is applied as it alters some of the same lines of code.

Also, from the StringTranslationTrait file:

/**
 * Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
 *
 * Using this trait will add t() and formatPlural() methods to the class. These
 * must be used for every translatable string, similar to how procedural code
 * must use the global functions t() and \Drupal::translation()->formatPlural().
 * This allows string extractor tools to find translatable strings.
 *
 * If the class is capable of injecting services from the container, it should
 * inject the 'string_translation' service and assign it to
 * $this->stringTranslation.
 *
...

Some of the files modified with this patch are services, which are capable of having the "string_translation" service injected, so we should follow the best practice here. I can re-roll the patch to accommodate both changes once the aforementioned issue is merged, so I only have to re-roll this once.

markdorison’s picture

markdorison’s picture

Status: Needs work » Needs review
FileSize
4.32 KB

Re-rolled patch.

markdorison’s picture

Status: Needs review » Needs work
adamzimmermann’s picture

Assigned: Unassigned » adamzimmermann

Looks good, but the dependency injection bit is still missing. I'll add that and re-roll this patch.

adamzimmermann’s picture

Assigned: adamzimmermann » Unassigned
Status: Needs work » Needs review
FileSize
5.54 KB
walangitan’s picture

Status: Needs review » Reviewed & tested by the community

#11 looks good with the dependency injection included.

markdorison’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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