From: vlys <vl...@ra...> - 2005-01-06 17:15:58
|
interesting... ;-) je vais tester ca NGUYEN DINH Quoc-Huy a =E9crit : > Hi there. > > I'm planning to install IlohaMail my new website. > But the thing is IlohaMail is always evoluate and often the language=20 > files are not up to date. > I'm interrested in French, English and Vietnamese. But updating both=20 > is quite long. > > So I've developped this PHP script. > > Usage: > Put this script in the source directory of IlohaMail of your server=20 > and open > it from a browser. Then select a language and a file to open for=20 > edit. Make > the changes and click on 'Save'. The new file will be generated,=20 > copy/paste > the content in the source file. > > How does it work ?: > The script includes the file from eng/ directory then it includes=20 > the same > file from the language directory and displays the variables declared=20 > inside > that file. If a string is translated then it will appear in the=20 > selected > language, if not it will be displayed in english and you will just=20 > have to > modify it. This is easier than opening english and language file,=20 > compare and > add new lines. > > You can have a look at my test site: > http://mail.qmel.com/IlohaMail/edit_lang.php > > I hope this script will help translators. > > -----------------------------------------------------------------------= - > > * This file is released under GPL. *=20 > http://www.fsf.org/copyleft/gpl.html *=20 > ***********************************************************************= ******/=20 > function authenticate() { $login=3D"admin"; $passwd=3D"admin";=20 > header('WWW-Authenticate: Basic realm=3D"My Realm"'); header('HTTP/1.0=20 > 401 Unauthorized'); echo 'Text to send if user hits Cancel button'; }=20 > if (!isset($_SERVER['PHP_AUTH_USER'])) { authenticate(); exit(); }=20 > else { if(!$_SERVER['PHP_AUTH_USER']!=3D$login &&=20 > $_SERVER['PHP_AUTH_PW']!=3D$passwd) { authenticate(); exit(); } }=20 > function editForm() { echo " > "; $handle=3Dopendir("../lang/"); $i=3D0; //$fileArray[]; while ($file = =3D=20 > readdir($handle)) { $fileArray[$i]=3D$file; $i++; } sort($fileArray);=20 > echo " "; $handle=3Dopendir("../lang/eng/"); $i=3D0; $fileArray=3Darray= ();=20 > while ($file =3D readdir($handle)) { $fileArray[$i]=3D$file; $i++; }=20 > sort($fileArray); echo " "; echo " > > "; } if($action=3D=3D"Edit") { echo "";=20 > $_POST["file"]=3Dereg_replace("[^a-zA-Z]","",$_POST["file"]);=20 > $_POST["lang"]=3Dereg_replace("[^a-zA-Z]","",$_POST["lang"]); /*=20 > $eng=3Dfopen("../lang/eng/{$_POST["file"]}.inc","r");=20 > $lang=3Dfopen("../lang/{$_POST["lang"]}/{$_POST["file"]}.inc","r");=20 > if($eng && $lang) { echo " > "; echo ""; echo " > > "; } */ include("../lang/{$_POST["lang"]}/init.inc"); $before =3D=20 > get_defined_vars(); include("../lang/eng/{$_POST["file"]}.inc");=20 > include("../lang/{$_POST["lang"]}/{$_POST["file"]}.inc"); echo " ";=20 > editForm(); echo "*To add an \\n please type '[br]'* > > "; echo " > "; echo ""; echo ""; echo ""; $after =3D get_defined_vars(); echo " > "; while(list($key,$val)=3Deach($after)) { if($key!=3D"before" &&=20 > $key!=3D"file" && $key!=3D"key" && !isset($before[$key])) {=20 > if(is_array($val)) { while(list($key2,$val2)=3Deach($val)) { echo "=20 > \${$key}[\"$key2\"] =3D =09 > \n"; } } else { echo " \${$key} =3D =09 > \n"; } } } echo " > > "; echo " > > "; } elseif($action=3D=3D"Save") {=20 > include("../lang/{$_POST["lang"]}/init.inc"); echo " "; echo " > > "; }else { echo ""; } editForm(); ?> Copyright =A9 2005 SnAKes > Qmel high capacity email <http://www.qmel.com/> > >------------------------------------------------------------------------ > >No virus found in this incoming message. >Checked by AVG Anti-Virus. >Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 03/01/2005 > =20 > --=20 No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 03/01/2005 |