Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / Language.php
blobca6fe031388f43b999c5456529e549239538b7fd
1 <?php
3 require_once 'HTMLPurifier/LanguageFactory.php';
5 class HTMLPurifier_Language
8 /**
9 * ISO 639 language code of language. Prefers shortest possible version
11 var $code = 'en';
13 /**
14 * Fallback language code
16 var $fallback = false;
18 /**
19 * Array of localizable messages
21 var $messages = array();
23 /**
24 * Has the language object been loaded yet?
25 * @private
27 var $_loaded = false;
29 /**
30 * Loads language object with necessary info from factory cache
31 * @note This is a lazy loader
33 function load() {
34 if ($this->_loaded) return;
35 $factory = HTMLPurifier_LanguageFactory::instance();
36 $factory->loadLanguage($this->code);
37 foreach ($factory->keys as $key) {
38 $this->$key = $factory->cache[$this->code][$key];
40 $this->_loaded = true;
43 /**
44 * Retrieves a localised message. Does not perform any operations.
45 * @param $key string identifier of message
46 * @return string localised message
48 function getMessage($key) {
49 if (!$this->_loaded) $this->load();
50 if (!isset($this->messages[$key])) return '';
51 return $this->messages[$key];