diff --git a/lib/Cake/I18n/I18n.php b/lib/Cake/I18n/I18n.php index 16fb9983d..43cb4b1d5 100644 --- a/lib/Cake/I18n/I18n.php +++ b/lib/Cake/I18n/I18n.php @@ -643,6 +643,26 @@ class I18n { return $definitions; } +/** + * Puts the parameters in raw translated strings + * + * @param string $translated The raw translated string + * @param array $args The arguments to put in the translation + * @return string Translated string with arguments + */ + public static function insertArgs($translated, array $args) { + if (empty($args)) { + return $translated; + } + + if (is_array($args[0])) { + $args = $args[0]; + } + + $translated = preg_replace('/(?