PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Aleksandar Zivanovic  >  iTranslate  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: iTranslate
Translate application texts read from INI files
Author: By
Last change:
Date: 5 years ago
Size: 1,231 bytes
 

Contents

Class file image Download
<?php
/**
 * User: Aleksandar Zivanovic <coapsyfactor@gmail.com>
 * Date: 12/27/16
 * Time: 3:57 PM
 */

/** Load required class */
require_once __DIR__ . '/iTranslate.php';

/** @var iTranslate $englishTranslate instance of translations for english language */
$englishTranslate = new iTranslate('en');

echo
$englishTranslate->formatTranslate('CURRENT_TIME', date('H:i:s', time()), date('l', time())) . "\n";

/** @var iTranslate $germanTranslate instance of translations for german language */
$germanTranslate = new iTranslate('de');

echo
$germanTranslate->formatTranslate('CURRENT_TIME', date('H:i:s', time()), date('l', time())) . "\n";

/** @var iTranslate $serbianTranslate instance of translations for serbian language */
$serbianTranslate = new iTranslate('rs');

echo
$serbianTranslate->formatTranslate('CURRENT_TIME', date('H:i:s', time()), date('l', time())) . "\n";

/** @var iTranslate $universalTranslate used to demonstrate language change on fly */
$universalTranslate = new iTranslate('en');

echo
$universalTranslate->translate('HELLO_WORLD') . "\n";

echo
$universalTranslate->setLanguage('de')->translate('HELLO_WORLD') . "\n";

echo
$universalTranslate->setLanguage('rs')->translate('HELLO_WORLD') . "\n";


For more information send a message to info at phpclasses dot org.