t() with token

Public

what is the correct way to handle t() with non word things added to the end?

Get raw version
php
  1. <?php
  2. $thing = t('Default: !date', array('!date' => format_date(REQUEST_TIME, 'medium'));
  3. $thing2 = $thing = t('Default: !date', array('!date' => format_date(REQUEST_TIME, 'medium'), array('context' => 'A hint to the translators what this is in case the context matters.'));
  4. // Many classes in Drupal have a t() method
  5. $thing3 = $this->t('Default: !date', array('!date' => format_date(REQUEST_TIME, 'medium'), array('context' => 'A hint to the translators what this is in case the context matters.'));
  6.  
  7. // Thanks Jeff!