Formagic translator class

Provides an standard interface used by all Formagic framework classes. Contains no stand-alone translation features: If no translation callback is provided, Formagic_Translator will simply return the same string that was passed in the first place.

package Formagic\Translator
author Florian Sonnenburg
since 1.0.0 First time introduced

 Methods

Alias for {@see translate()}

_(string $string, array $arguments = array()) : string
inherited_from \Formagic_Translator_Interface::_()

Parameters

$string

string

The string to be translated

$arguments

array

Array of arguments to be inserted into the string

Returns

stringThe translated string

Constructor

__construct() 

Empty by default, allows subclass initialization.

Sets the translation callback with class and method.

setCallback(mixed $object, string $method) : void

Parameters

$object

mixed

Translation class

$method

string

Translation class

Translates a string or returns it if no translator is set.

translate(string $string, array $arguments = array()) : string
inherited_from \Formagic_Translator_Interface::translate()

Parameters

$string

string

The string to be translated

$arguments

array

Array of arguments to be inserted into the string

Returns

stringThe translated string

 Properties

 

Callback array containing the translation class and method

$_callback : array

Default