<?php
class olocale {
private $aMessages = array ();
private $locale = '';
public function __construct ($loc) {
$this -> locale = $loc;
$this -> setaMessages ();
}
private function setaMessages () {
$aFiles = scandir ('locales/'.$this -> locale);
$aForbid = array ('.', '..');
$aFiles = array_diff ($aFiles, $aForbid);
foreach ($aFiles as $file) {
$cat = substr ($file, 0, strlen ($file) -4);
$xml = simplexml_load_file('locales/'.$this -> locale.'/'.$file);
foreach ($xml as $clef => $val) {
$this -> aMessages[$cat][$clef] = $val;
}
}
}
public function getMsg ($cat, $clef) {
return (string)$this -> aMessages[$cat][$clef];
}
public function getLoc () {
return (string)$this -> locale;
}
}
?>
|