Revision 55,
874 bytes
checked in by niltonneto, 17 years ago
(diff) |
Nova versão do Instant Messenger.
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[55] | 1 | <?php |
---|
| 2 | |
---|
| 3 | class Language |
---|
| 4 | { |
---|
| 5 | const _DEFAULT_LANGUAGE_ = 'ENGLISH'; |
---|
| 6 | static private $_language = NULL; |
---|
| 7 | |
---|
| 8 | static private $_phrase = NULL; |
---|
| 9 | |
---|
| 10 | function __construct() |
---|
| 11 | { |
---|
| 12 | echo 'ok'; |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | function setLanguage( $pLanguage = false ) |
---|
| 16 | { |
---|
| 17 | if ( !$pLanguage || !is_file($pLanguage . '_language.txt') ) |
---|
| 18 | return false; |
---|
| 19 | |
---|
| 20 | $this->_language = $pLanguage; |
---|
| 21 | $this->_phrase = file($this->_language . '_language.txt'); |
---|
| 22 | |
---|
| 23 | foreach($this->_phrase as $val ) |
---|
| 24 | { |
---|
| 25 | $_phrase = explode('§§', $val); |
---|
| 26 | if ( sizeof($_phrase) != 2 ) |
---|
| 27 | continue; |
---|
| 28 | $this->_phrase[$_phrase[0]] = $_phrase[1]; |
---|
| 29 | } |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | public function phrase( $pPhrase ) |
---|
| 33 | { |
---|
| 34 | if ( !$this->_phrase || !isset($this->_phrase[$pPhrase]) ) |
---|
| 35 | return '** ' . self::_DEFAULT_LANGUAGE_; |
---|
| 36 | else |
---|
| 37 | return $this->_phrase[$pPhrase]; |
---|
| 38 | } |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.