0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-10 07:38:41 +00:00
htmlpurifier/library/HTMLPurifier/Language.php
Edward Z. Yang fda2043ace [1.7.0] Code audit
- Add set accessor, update access control on variables in AttrTypes
- Add warning notes to non-unit tested, out of date or unused code files
- Remove redundant include in EntityParser, expand string regexp to match all ASCII XML-style entities
- Remove obsolete hooks in HTMLModule

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1078 48356398-32a2-884e-a903-53898d9a118a
2007-05-20 19:45:49 +00:00

58 lines
1.3 KiB
PHP

<?php
require_once 'HTMLPurifier/LanguageFactory.php';
// UNUSED
class HTMLPurifier_Language
{
/**
* ISO 639 language code of language. Prefers shortest possible version
*/
var $code = 'en';
/**
* Fallback language code
*/
var $fallback = false;
/**
* Array of localizable messages
*/
var $messages = array();
/**
* Has the language object been loaded yet?
* @private
*/
var $_loaded = false;
/**
* Loads language object with necessary info from factory cache
* @note This is a lazy loader
*/
function load() {
if ($this->_loaded) return;
$factory = HTMLPurifier_LanguageFactory::instance();
$factory->loadLanguage($this->code);
foreach ($factory->keys as $key) {
$this->$key = $factory->cache[$this->code][$key];
}
$this->_loaded = true;
}
/**
* Retrieves a localised message. Does not perform any operations.
* @param $key string identifier of message
* @return string localised message
*/
function getMessage($key) {
if (!$this->_loaded) $this->load();
if (!isset($this->messages[$key])) return '';
return $this->messages[$key];
}
}
?>