I don't have the exact answer you are looking for, but I could suggest a solution if you don't mind overwriting the current Kohana::message() method. I have done something similar in my own app.
Just create a Kohana.php file in your 'applications/classes' with the following code:
class Kohana extends Kohana_Core {
public static function message($file, $path = NULL, $default = NULL, $replacements = array())
{
static $messages;
if ( ! isset($messages[$file]))
{
// Create a new message list
$messages[$file] = array();
if ($files = Kohana::find_file('messages', $file))
{
foreach ($files as $f)
{
// Combine all the messages recursively
$messages[$file] = Arr::merge($messages[$file], Kohana::load($f));
}
}
}
if ($path === NULL)
{
// Return all of the messages
$message = $messages[$file];
}
else
{
// Get a message using the path
$message = Arr::path($messages[$file], $path, $default);
}
return !empty($replacements) ? strtr($message,$replacements) : $message;
}
}
Basically the only notable change is the addition of $replacements
argument and return !empty($replacements) ? strtr($message,$replacements) : $message;
which replaces the contents of your message with those that are in your replacements array.
So you can now do this:
Kohana::message('user', 'greeting', NULL, array(':user' => $name));
messages/user.php:
return array
(
'greeting' => __('user.greeting'),
);