OpenSencillo  2015.002
translate Class Reference
+ Inheritance diagram for translate:
+ Collaboration diagram for translate:

Public Member Functions

 __construct ($name, $lang)
 translate ($tKey)
 addTranslate ($tKey, $tData)

Protected Attributes

 $tSource
 $lang

Detailed Description

Definition at line 8 of file translate.tool.framework.php.


Constructor & Destructor Documentation

__construct ( name,
lang 
)

Definition at line 13 of file translate.tool.framework.php.

        {
                $this->name = $name;
                $this->lang = $lang;
                
                if(file_exists($this->name))
                {
                        $this->tSource = json_decode($this->read(),true);       
                }
        }

Member Function Documentation

addTranslate ( tKey,
tData 
) [final]

Definition at line 41 of file translate.tool.framework.php.

        {
                if((is_string($tKey))&&(is_array($tData)))
                {
                        $this->tSource[$tKey]=$tData;
                        $this->write(json_encode($this->tSource));
                        return true;
                }
                else 
                {
                        return false;
                }
        }
translate ( tKey) [final]

Find translate by key

Parameters:
string$tKey
Returns:
bool

Definition at line 29 of file translate.tool.framework.php.

        {
                return ($this->tSource[$tKey][$this->lang] ? $this->tSource[$tKey][$this->lang] : $tKey);
        }

Field Documentation

$lang [protected]

Definition at line 11 of file translate.tool.framework.php.

$tSource [protected]

Definition at line 10 of file translate.tool.framework.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables