source: trunk/instant_messenger/bkp/instant_messenger_32/inc/Language.class.php @ 151

Revision 151, 874 bytes checked in by niltonneto, 16 years ago (diff)

Commit da nova versão do módulo, usando agente em C.
Vide Página do módulo do Trac:
http://www.expressolivre.org/dev/wiki/messenger

A versão anterior encontra-se na subpasta bkp (32/64).

Line 
1<?php
2
3class 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.