Flourish PHP Unframework

fText

static class, v1.0.0b2

Provides internationlization support for strings

Changes:
1.0.0b2Updated compose() to more handle $components passed as an array 2/5/09
1.0.0bThe initial implementation 11/12/08

Static Methods

::compose() public

Performs an sprintf() on a string and provides a hook for modifications such as internationalization

Signature

string compose( string $message, mixed $component [, ... ] )

Parameters

string $message A message to compose
mixed $component [, ... ] A string or number to insert into the message

Returns

The composed message

::registerComposeCallback() public

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.

Signature

void registerComposeCallback( string $timing, callback $callback )

Parameters

string $timing When the callback should be executed - 'pre' or 'post' performing the actual composition
callback $callback The callback

::reset() internal public

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

Signature

void reset( )