PHP Classes

iTranslate: Translate application texts read from INI files

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 150 All time: 9,065 This week: 339Up
Version License PHP version Categories
itranslate 1.0BSD License5Localization, PHP 5, Files and Folders
Description 

Author

This class can translate application texts read from INI files.

It takes a given text and finds the respective translation for the current language.

The tranlation texts are retrieved from INI configuration files. Each text has a section. Translations are in the section files. The lines start with the language followed the respective translation of the text for that language.

Picture of Aleksandar Zivanovic
  Performance   Level  
Name: Aleksandar Zivanovic <contact>
Classes: 16 packages by
Country: Serbia Serbia
Age: 30
All time rank: 16237 in Serbia Serbia
Week rank: 312 Up2 in Serbia Serbia Up
Innovation award
Innovation award
Nominee: 4x

Example

<?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";



  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example script
Plain text file iTranslate.php Class Main class
Accessible without login Plain text file strings.trans Data Translations file

 Version Control Unique User Downloads Download Rankings  
 0%
Total:150
This week:0
All time:9,065
This week:339Up