aliroLanguage Class Reference

Inheritance diagram for aliroLanguage:

cachedSingleton

List of all members.

Public Member Functions

 getDate ($format=null, $timestamp=null)
 formatDate ($time=null, $format=null)
 getDateFormat ()
 changeCharset ($value)
 validCharset ($code)

Static Public Member Functions

static getInstance ()

Protected Member Functions

 __construct ()
 setupLanguage ($langspec)

Protected Attributes

 $languages = array()
 $default_language = ''
 $default_charset = ''
 $base_charset = 'utf-8'
 $current_language = ''

Static Protected Attributes

static $instance = __CLASS__

Private Member Functions

 checkLanguage ()


Detailed Description

Language Class for Aliro See top level index.php for Copyright etc.

Definition at line 7 of file aliroLanguage.php.


Constructor & Destructor Documentation

aliroLanguage::__construct (  )  [protected]

Definition at line 16 of file aliroLanguage.php.

References aliroCore::getInstance(), setupLanguage(), and T_().

00016                                       {
00017         $core = aliroCore::getInstance();
00018         $this->default_charset = $core->getCfg('charset');
00019         if (!$this->default_charset) $this->default_charset = $this->base_charset;
00020         $langspec = $core->getCfg('locale');
00021         if (!$this->setupLanguage($langspec) AND !$this->setupLanguage('en')) trigger_error(T_('Default language specification is invalid'), E_USER_ERROR);
00022         define ('_ALIRO_LANGUAGE', $this->default_language);
00023     }


Member Function Documentation

aliroLanguage::setupLanguage ( langspec  )  [protected]

Definition at line 25 of file aliroLanguage.php.

Referenced by __construct().

00025                                                  {
00026         $language = new aliroLanguageBasic ($langspec, _ALIRO_CLASS_BASE.'/language/');
00027         if ($language->isValid) {
00028             $this->languages[$langspec] = $language;
00029             $this->languages[$langspec]->setCharset($this->default_charset);
00030             $this->default_language = $langspec;
00031             return true;
00032         }
00033         return false;
00034     }

static aliroLanguage::getInstance (  )  [static]

Definition at line 36 of file aliroLanguage.php.

Referenced by aliroCore::fixLanguage(), aliroHTML::formatDate(), and aliroFriendlyBase::formatDate().

00036                                           {
00037         if (!is_object(self::$instance)) {
00038             self::$instance = parent::getCachedSingleton(self::$instance);
00039             self::$instance->checkLanguage();
00040         }
00041         return self::$instance;
00042     }

aliroLanguage::checkLanguage (  )  [private]

Definition at line 44 of file aliroLanguage.php.

References $_REQUEST, and aliroCore::set().

00044                                       {
00045         $this->current_language = empty($_REQUEST['lang']) ? $this->default_language : $_REQUEST['lang'];
00046         if (!isset($this->languages[$this->current_language])) {
00047             $this->languages[$this->current_language] = new aliroLanguageBasic ($this->current_language, _ALIRO_CLASS_BASE.'/language/');
00048             $this->languages[$this->current_language]->setCharset($this->default_charset);
00049             if (!$this->languages[$this->current_language]->isValid) $this->languages[$this->current_language] = 'Invalid';
00050         }
00051         if (!is_object($this->languages[$this->current_language])) $this->current_language = $this->default_language;
00052         define ('_ALIRO_LANGUAGE_CODE', $this->current_language);
00053         aliroCore::set('locale', $this->current_language);
00054         DEFINE('_ISO','charset='.$this->default_charset);
00055         $dateformat = $this->languages[$this->current_language]->date_format;
00056         DEFINE('_DATE_FORMAT_LC', $dateformat); //Uses PHP's strftime Command Format
00057         DEFINE('_DATE_FORMAT_LC2', $dateformat);
00058         define ('_JOOMLA_LANGUAGE', $this->languages[$this->current_language]->iso639.'-GB');
00059         $this->languages[$this->current_language]->startGettext();
00060     }

aliroLanguage::getDate ( format = null,
timestamp = null 
)

Definition at line 62 of file aliroLanguage.php.

Referenced by formatDate().

00062                                                                {
00063         return $this->languages[$this->current_language]->getDate($format, $timestamp);
00064     }

aliroLanguage::formatDate ( time = null,
format = null 
)

Definition at line 66 of file aliroLanguage.php.

References getDate().

00066                                                           {
00067         return $this->getDate($format, ($time ? strtotime($time) : time()));
00068     }

aliroLanguage::getDateFormat (  ) 

Definition at line 70 of file aliroLanguage.php.

00070                                     {
00071         return $this->languages[$this->current_language]->getDateFormat();
00072     }

aliroLanguage::changeCharset ( value  ) 

Definition at line 74 of file aliroLanguage.php.

00074                                            {
00075         return $this->base_charset == $this->default_charset ? $value : $this->languages[$this->current_language]->changeCharset($value);
00076     }

aliroLanguage::validCharset ( code  ) 

Definition at line 78 of file aliroLanguage.php.

00078                                          {
00079         return $this->languages[$this->current_language]->validCharset($code);
00080     }


Member Data Documentation

aliroLanguage::$instance = __CLASS__ [static, protected]

Definition at line 8 of file aliroLanguage.php.

aliroLanguage::$languages = array() [protected]

Definition at line 10 of file aliroLanguage.php.

aliroLanguage::$default_language = '' [protected]

Definition at line 11 of file aliroLanguage.php.

aliroLanguage::$default_charset = '' [protected]

Definition at line 12 of file aliroLanguage.php.

aliroLanguage::$base_charset = 'utf-8' [protected]

Definition at line 13 of file aliroLanguage.php.

aliroLanguage::$current_language = '' [protected]

Definition at line 14 of file aliroLanguage.php.


The documentation for this class was generated from the following file:

Generated on Wed May 14 13:01:59 2008 for ALIRO by  doxygen 1.5.5