PHP Classes

PHP Translation Text From Files: Translate application texts with translation 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: 224 This week: 1All time: 8,220 This week: 560Up
Version License PHP version Categories
translation-files 1.0.0BSD License5Localization, PHP 5, Files and Folders
Description 

Author

This class can translate application texts with translation files.

It can load translations of texts for a given language from a file in the translations directory for a given language.

The class returns the translated text or the original text if the translation is missing in the file.

Picture of Name Removed
  Performance   Level  
Name: Name Removed <contact>
Classes: 4 packages by
Country: ???
Age: ???
All time rank: 2029
Week rank: 109 Up

Recommendations

Example

<?php
// Translation From Files Class
// Developed by Takis Maletsas
// @2016
   
require_once('translator.class.php');

   
$translate = new Translator;

   
$translate->set_language('el');

   
//Change translations directory
    //$translate->set_translations_dir('');

   
$translate->translate('Hello world!'); //&#915;&#949;&#953;&#940; &#963;&#959;&#965; &#954;&#972;&#963;&#956;&#949;!
   
echo "<br/>";
   
$translate->translate('It is Takis'); //&#917;&#943;&#957;&#945;&#953; &#959; &#932;&#940;&#954;&#951;&#962;
   
echo "<br/>";

   
$translate->set_language('abcde');
   
$translate->translate('Hello world!'); //Hello world!
   
echo "<br/>";
   
$translate->translate('It is Takis'); //It is Takis
?>


  Files folder image Files  
File Role Description
Files folder imagetranslations (1 file)
Plain text file translator.class.php Class Class
Accessible without login Plain text file example.php Example Example

  Files folder image Files  /  translations  
File Role Description
  Accessible without login Plain text file el.lang Data Example translation to Greek

 Version Control Unique User Downloads Download Rankings  
 0%
Total:224
This week:1
All time:8,220
This week:560Up