use sprintf for translations

This commit is contained in:
Jakob Sack 2011-08-10 11:08:30 +02:00
parent 74be4644ed
commit 7b653dbca6
1 changed files with 4 additions and 3 deletions

View File

@ -97,16 +97,17 @@ class OC_L10N{
/** /**
* @brief Translating * @brief Translating
* @param $text The text we need a translation for * @param $text The text we need a translation for
* @param $parameters default:array() Parameters for sprintf
* @returns Translation or the same text * @returns Translation or the same text
* *
* Returns the translation. If no translation is found, $text will be * Returns the translation. If no translation is found, $text will be
* returned. * returned.
*/ */
public function t($text){ public function t($text, $parameters = array()){
if(array_key_exists($text, $this->translations)){ if(array_key_exists($text, $this->translations)){
return $this->translations[$text]; return vsprintf( $this->translations[$text], $parameters );
} }
return $text; return vsprintf( $text, $parameters );
} }
/** /**