PHP Classes

PHP Translation Text From Files: Translate application texts with translation 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: 226 All time: 8,204 This week: 71Up
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: ???

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 (3)  
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 (3)  /  translations  
File Role Description
  Accessible without login Plain text file el.lang Data Example translation to Greek

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:226
This week:0
All time:8,204
This week:71Up