initial setup of framework code
[cacert-mgr.git] / manager / library / l10n / L10n.php
1 <?php
2 /**
3 * encapsulate Zend_Locale within an singleton class
4 * @author markus
5 * $Id: L10n.php 13 2009-11-24 14:52:56Z markus $
6 */
7 class L10n {
8 /**
9 * static pointer to instance
10 * @var L10n
11 */
12 private static $instance = null;
13
14 /**
15 * config object
16 * @var Zend_Locale
17 */
18 private $locale = null;
19
20 /**
21 * make new translate
22 */
23 protected function __construct() {
24 $this->locale = new Zend_Locale();
25 }
26
27 /**
28 * get already existing instance, make new instance or throw an exception
29 * @return L10n
30 */
31 public static function getInstance() {
32 if (self::$instance === null) {
33 self::$instance = new L10n();
34 }
35
36 return self::$instance;
37 }
38
39 /**
40 * magic __call dispatches all unknown methods to Zend_Locale
41 * @param unknown_type $method
42 * @param unknown_type $arguments
43 */
44 public function __call($method, $arguments) {
45 return call_user_func_array(array($this->locale, $method), $arguments);
46 }
47 }