
Provides internationlization support for strings
1.0.0b2 | Updated compose() to more handle $components passed as an array 2/5/09 |
---|---|
1.0.0b | The initial implementation 11/12/08 |
Performs an sprintf() on a string and provides a hook for modifications such as internationalization
string compose( string $message, mixed $component [, ... ] )
string | $message | A message to compose |
mixed | $component [, ... ] | A string or number to insert into the message |
The composed message
Adds a callback for when a message is created using compose()
The primary purpose of these callbacks is for internationalization of error messaging in Flourish. The callback should accept a single parameter, the message being composed and should return the message with any modifications.
The timing parameter controls if the callback happens before or after the actual composition takes place, which is simply a call to sprintf(). Thus the message passed 'pre' will always be exactly the same, while the message 'post' will include the interpolated variables. Because of this, most of the time the 'pre' timing should be chosen.
void registerComposeCallback( string $timing, callback $callback )
string | $timing | When the callback should be executed - 'pre' or 'post' performing the actual composition |
callback | $callback | The callback |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Resets the configuration of the class
void reset( )