d61df6228d76c54184237ff505c199f346424e19
[lhc/web/wiklou.git] / maintenance / languages.inc
1 <?php
2 /**
3 * Library to grab data from languages files
4 *
5 * WORK IN PROGRESS. There is some bugs when including the same
6 * file multiple time :(((
7 */
8 require_once('commandLine.inc');
9
10 class languages {
11 /** Contain the list of languages available */
12 var $list = array();
13 /** some messages for the current lang */
14 var $messages = array();
15
16 function __construct() {
17 $this->clear();
18 $this->loadList();
19 }
20
21 function clear() {
22 $this->list = array();
23 $this->messages = array();
24 }
25
26 function loadList() {
27 global $IP;
28 $this->list = array();
29
30 // available language files
31 $dir = opendir("$IP/languages");
32 while ($file = readdir($dir)) {
33 if (preg_match("/Messages([^.]*?)\.php$/", $file, $m)) {
34 $this->list[] = $m[1];
35 }
36 }
37 sort($this->list);
38 }
39
40 function getList() { return $this->list; }
41 }
42 ?>