@admin
I'm NOT really familiar with all these numerous PUBLIC translation tools, yet needed to look at the code below and wonder
whether it can be implemented that way, translations OUTSIDE handling menu and field description could be made by far easier.
I'm NOT really familiar with all these numerous PUBLIC translation tools, yet needed to look at the code below and wonder
whether it can be implemented that way, translations OUTSIDE handling menu and field description could be made by far easier.
<?php class Translator { private $language = 'en'; private $lang = array(); public function __construct($language){ $this->language = $language; } private function findString($str) { if (array_key_exists($str, $this->lang[$this->language])) { echo $this->lang[$this->language][$str]; return; } echo $str; } private function splitStrings($str) { return explode('=',trim($str)); } public function __($str) { if (!array_key_exists($this->language, $this->lang)) { if (file_exists($this->language.'.txt')) { $strings = array_map(array($this,'splitStrings'),file($this->language.'.txt')); foreach ($strings as $k => $v) { $this->lang[$this->language][$v[0]] = $v[1]; } return $this->findString($str); } else { echo $str; } } else { return $this->findString($str); } } } ?>