ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
translators.php
Go to the documentation of this file.
1 <?php
2 /*
3  +----------------------------------------------------------------------+
4  | HTML/XML Validator |
5  +----------------------------------------------------------------------+
6  | Copyright (c) 2004-2005 Nuno Lopes |
7  +----------------------------------------------------------------------+
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU Lesser General Public |
10  | License as published by the Free Software Foundation; either |
11  | version 2.1 of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16  | Lesser General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU Lesser General Public |
19  | License along with this library; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
21  | 02111-1307 USA. |
22  +----------------------------------------------------------------------+
23  | http://validator.aborla.net/ |
24  +----------------------------------------------------------------------+
25 
26 vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
27 
28  $Id: translators.php 8377 2005-08-15 09:27:49Z akill $
29 */
30 
31 ini_set('default_charset', 'UTF-8');
32 
33 include './include.inc';
34 include './local/en.inc';
35 
36 common_header('Translators');
37 
38 $files = scandir('./local');
39 $files = array_splice($files, 2); // remove '.' and '..'
40 $skip = array('CVS'=>1, 'en.inc'=>1, 'convert.php'=>1);
41 
42 // fetch the english revision
43 preg_match('/\$'.'Revision: 1\.(\d+)/', file_get_contents('./local/en.inc'), $data);
45 
46 echo <<< HTML
47 <p>&nbsp;</p>
48 <p>This page is used to keep track of the current translations and their maintainers and revisions.
49  Therefore we thank all the translators listed below for their work!</p>
50 <p>If you would like to become the maintainer of the translation of a language, please download the
51  <a href="/local/en.inc">english file</a> and translate it (please encode the file in UTF-8). Then, send the file
52  and your details (name, site, e-mail) to our <a href="mailto:htmlchecker-devl@lists.sourceforge.net">mailling list</a>.</p>
53 
54 <p>English Revision: $revision</p>
55 <table border='1'>
56  <tr>
57  <td>Language</td>
58  <td>EN Revision</td>
59  <td>Revision</td>
60  <td>Translator</td>
61  <td>E-mail</td>
62  <td>Site</td>
63  </tr>
64 
65 HTML;
66 
67 // iterate through the translated files
68 foreach ($files as $file) {
69 
70  if (isset($skip[$file])) continue;
71 
72  $lang = explode('.', $file);
73  $lang = $lang[0];
74 
75  $file = file_get_contents("./local/$file");
76  $rev = $email = $site = $name = '';
77  $en_rev = 0;
78 
79  if (preg_match('/\$'.'Revision: 1\.(\d+)/', $file, $data))
80  $rev = $data[1];
81 
82  if (preg_match('/EN-Revision: 1\.(\d+)/', $file, $data))
83  $en_rev = $data[1];
84 
85  if(preg_match('/Translation:\s*([^(\r\n]+)\s*(\(.+\))?/',$file, $data)) {
86  $name = rtrim($data[1]);
87 
88  if (isset($data[2]) && preg_match_all('/\(([^)]+)\)/', $data[2], $contacts)) {
89 
90  foreach($contacts[1] as $contact) {
91  if(strpos($contact, '@'))
92  $email = str_replace(array('@', '.'), array(' -at- ', ' ! '), $contact);
93  else
94  $site = $contact;
95  }
96  }
97  }
98 
99  $diff = $revision - $en_rev;
100  $lang = "{$langs[$lang]} ($lang)";
101 
102  if ($diff == 0)
103  $trclass = 'ok';
104 
105  else {
106  $lang = "<a href='http://cvs.sourceforge.net/viewcvs.py/htmlchecker/validator/local/en.inc?tr1=1.$en_rev&amp;tr2=1.$revision&amp;r1=text&amp;r2=text&amp;diff_format=u'>$lang</a>";
107 
108  if ($diff <= 5)
109  $trclass = 'old';
110  else
111  $trclass = 'critical';
112  }
113 
114  $site = $site ? "<a href='$site'>$site</a>" : '&nbsp;';
115  $email = $email ? $email : '&nbsp;';
116 
117  echo <<< HTML
118  <tr class="$trclass">
119  <td>$lang</td>
120  <td>$en_rev</td>
121  <td>$rev</td>
122  <td>$name</td>
123  <td>$email</td>
124  <td>$site</td>
125  </tr>
126 
127 HTML;
128 }
129 ?>
130 
131 </table>
132 
133 <p>&nbsp;</p>
134 
135 <div class="centered"><table border="1">
136  <tr>
137  <td>Legend</td>
138  </tr>
139  <tr class="ok">
140  <td>The translation is up-to-date!</td>
141  </tr>
142  <tr class="old">
143  <td>The translation is a bit old (revisions &lt;= 5)</td>
144  </tr>
145  <tr class="critical">
146  <td>The translation is highly outdated. Please update ASAP!</td>
147  </tr>
148 </table></div>
149 
150 <?php
151 common_footer();
152 ?>