ip94, например, что-то типа такого
class Translator {
private $_locale;
private $_dictionary;
public function __construct($locale = 'en_US')
{
$this->_locale = $locale;
}
public function translate($message)
{
$dictionary = $this->getDictionary();
if (isset($dictionary[$message])) {
return $dictionary[$message];
}
return $message;
}
private function getDictionary()
{
if (!$this->_dictionary) {
$this->_dictionary = $this->_locale . '.php';
}
return $this->_dictionary;
}
}
файл ru_RU.php
return array(
'Hello, world!' => 'Привет, мир!'
);
использование:
$translator = new Translator('ru_RU');
echo $translator->translate('Hello, world!');
З.Ы. можно реализовать как singleton
http://ru.wikipedia.org/wiki/Singleton#.D0....BD.D0.B0_PHP_5