Skip to main content
Post Made Community Wiki by avpaderno
Source Link
user49
user49

There's no right or wrong t because at the end of the day you end up using the translate method of the string_translation service. Passing around objects are pretty pointless because the StringTranslationTrait and t both execute the exact same code: \Drupal::service('string_translation')->translate($string, $args, $options). The call chain is different of course but at the end of the day, that's the exact call they both run.