dynamic string translation

Events happening in the community are now at Drupal community events on www.drupal.org.
jaochoo's picture

Translating dynamic string? $subject = $user . " commented on your " . $type;

I need to send email notifications like the following: $subject = $username . " commented on your " . $type; whereas $type is the content type, e. g. "blog", "gallery", etc.

Now I would like to send translated emails depending on the user's preferred language. So I also need to translate the $type, of course, otherwise I would get a mixed-language subject line. So my first idea was to use:

<?php
$subject
= t("!username commented on your !type", array(
 
'!username' => $user->name,
 
'!type' => t($type)
));
?>
Read more
Subscribe with RSS Syndicate content