PHP Classes

iTranslate: Translate application texts read from INI files

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 151 All time: 9,071 This week: 455Up
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: 16206 in Serbia Serbia
Week rank: 192 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 (3)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:151
This week:0
All time:9,071
This week:455Up