Skip to content

Commit 62b2162

Browse files
committed
[i18n] Add helper to sfController to translate messages
1 parent 963e560 commit 62b2162

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/action/sfComponent.class.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,20 @@ public function logMessage($message, $priority = 'info')
156156
}
157157
}
158158

159+
/**
160+
* Gets the translation for the given string
161+
*
162+
* @param string $string The string to translate
163+
* @param array $args An array of arguments for the translation
164+
* @param string $catalogue The catalogue name
165+
*
166+
* @return string The translated string
167+
*/
168+
public function __($string, $args = array(), $catalogue = 'messages')
169+
{
170+
return $this->context->getI18N()->__($string, $args, $catalogue);
171+
}
172+
159173
/**
160174
* Returns the value of a request parameter.
161175
*

0 commit comments

Comments
 (0)