PHP Classes

File: altext.php

Recommend this page to a friend!
  Classes of Everton da Rosa   AlText   altext.php   Download  
File: altext.php
Role: Auxiliary script
Content type: text/plain
Description: Main script file
Class: AlText
Translate texts extracted from code into INI files
Author: By
Last change:
Date: 9 years ago
Size: 486 bytes
 

Contents

Class file image Download
<?php

/**
 * Translates text to the selected language.
 * @param string $text The text to translate.
 * @return string The translated text.
 * @throws Exception
 */
function altext($text){
   
$sha1 = sha1($text);
   
    if(!isset(
$GLOBALS['LANG'])){
        throw new
Exception('LANG not defined!');
    }else{
       
$LANG = $GLOBALS['LANG'];
    }
   
    if(@
key_exists($sha1, $LANG)){
        return
$LANG[$sha1];
    }else{
        return
$text;
    }
}