/** * @global Function T * * A global convenience method for the namespaced translator function. See Tee\Translator::translate for usage */ function T() { $args = func_get_args(); $string = array_shift($args); return \Tee\Translator::translate($string, $args); }
<?php require_once 'vendor/autoload.php'; use Tee\Translator as Trans; Trans::configure(array('adapter' => '\\Tee\\Adapter\\JSON', 'adapterConfig' => array('translations' => 'example_translations/'), 'locale' => 'de')); ?> <h1>Tee testing</h1> <h2>Simple test</h2> <pre> <code><?= T("Hello world, my name is Kerbal") ?> <?= T("Hello world, my name is %s", 'James') ?> <?= T("Hello world, my name is %s", array('Bob')) ?></code> <?= T("Hello %s, my name is %s", array('Earth', 'Bob')) ?></code> <?= T("Hello %s, my name is %s", 'Earth', 'Bob') ?></code> </pre> <?php echo T("Hello world, my name is Kerbal"); ?> <br> <?php echo T("Hello world, my name is %s", 'James'); ?> <br> <?php echo T("Hello world, my name is %s", array('Bob')); ?> <br> <?php