Skip to content

Convert t() to $this->t()#726

Merged
jmolivas merged 1 commit intohechoendrupal:masterfrom
palantirnet:t-method
Jul 2, 2015
Merged

Convert t() to $this->t()#726
jmolivas merged 1 commit intohechoendrupal:masterfrom
palantirnet:t-method

Conversation

@stevector
Copy link
Copy Markdown
Contributor

This PR updates templates generated classes that still used t().

I'm chatting with Tim Plunkett in IRC right now about https://github.com/hechoendrupal/DrupalConsole/blob/master/templates/module/module.twig

Which generates

/**
 * Implements hook_help().
 */
function dcdtest_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the dcdtest module.
    case 'help.page.dcdtest':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('My Awesome Module') . '</p>';
      return $output;

    default:
  }
}

@stevector stevector changed the title WIP: Convert t() to $this->t() Convert t() to $this->t() Jul 1, 2015
@stevector
Copy link
Copy Markdown
Contributor Author

Tim says, and I agree, that t() in procedural code is fine. It does nothing but wrap \Drupal::translation()->translate()

@jmolivas jmolivas modified the milestone: 0.7.15-release Jul 1, 2015
jmolivas added a commit that referenced this pull request Jul 2, 2015
@jmolivas jmolivas merged commit 9f8c3b4 into hechoendrupal:master Jul 2, 2015
@jmolivas
Copy link
Copy Markdown
Member

jmolivas commented Jul 2, 2015

Thanks for the PR @stevector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants