t() function doesn't translate strings inside node fields I built a rule using rules module to create a node of a certain content type which inserts a text of full_html format inside a body field when follow flag is flagged. This is the rule

$values = array(
        'type' =&gt; 'notification',
        'uid' =&gt; UID_OF_A_USER,
        'status' =&gt; 0,
        'comment' =&gt; 0,
        'promote' =&gt; 0,
        'language'  =&gt; 'en'
);
$entity = entity_create ('node', $values);
$ewrapper = entity_metadata_wrapper('node', $entity);
$url = "PROFILE_URL_OF_A_USER";
$uname = "USERNAME_OF_A_USER";
$link = l("$uname","$url");
$body_content = t("!link started following you.",array('!link' =&gt; $link));
$ewrapper-&gt;field_body-&gt;set(array('value' =&gt; $my_body_content ,'format'=&gt;'full_html') );
$ewrapper-&gt;save();


When a user uses Follow flag to follow another user, a message is sent to the followed user which says, !link started following you.

This rule works perfectly but the problem is with translation of the !link started following you.. My website supports three languages. This is the problem:

If a user (flagging user) flags another user using Follow flag and he is in a certain language, say french, The above message in french language will be sent to the followed user, no matter in what language the followed user is viewing his profile, he will see this message in french language and by switching language it will not be translated. 

I need this message to be translated in the current language of flagged user when he is viewing its profile but the message is sent in the language of the flagging user and in the profile page of the followed user will not be translated even if he switches the language.

How can I make this message translatable?
Have a look at the options you can pass on to the t() function. You can explicitly say which language you want.

So you might do something like this to handle you message content :

$to_user = get_destination_user(); // whichever way you do that...
$body_content = t("!link started following you.",
                  array('!link' =&gt; $link),
                  array('langcode' =&gt; $to_user-&gt;language ));


In essence something like the above should do it.

Also make sure that the user language is set and valid. For this you might do something like :

$to_user = get_destination_user(); // whichever way you do that...

// get destination user language if set
$message_lang = !empty($to_user-&gt;language) ? $to_user-&gt;language : '';

// check if language is defined on our site
$languages = language_list();
if (!isset($languages[$message_lang])) {
    $message_lang = '';
}
// check if the language is enabled
if (!$languages[$message_lang]-&gt;enabled) {
    $message_lang = '';
}

$body_content = t("!link started following you.",
                  array('!link' =&gt; $link),
                  array('langcode' =&gt; $message_lang ));