| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
ini_set('include_path',ini_get('include_path').':../..');
|
|
|
4 |
|
|
|
5 |
/**
|
|
|
6 |
*
|
|
|
7 |
* test of Message_Translate
|
|
|
8 |
*
|
|
|
9 |
* DB file: http://wolfram.kriesing.de/libs/php/examples/SimpleTemplate/translate.sql
|
|
|
10 |
*
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
require_once( 'HTML/IT.php' );
|
|
|
15 |
$tpl = new IntegratedTemplate( '.' );
|
|
|
16 |
$tpl->loadTemplatefile( 'I18N_Message_Translate.tpl' );
|
|
|
17 |
$langLinks = '<a href="'.$_SERVER['PHP_SELF'].'?lang=de">german</a>, '.
|
|
|
18 |
'<a href="'.$_SERVER['PHP_SELF'].'?lang=en">english</a>';
|
|
|
19 |
$tpl->setVariable( 'langLinks' , $langLinks );
|
|
|
20 |
$tpl->setVariable( 'sourceCode' , $sourceCode );
|
|
|
21 |
$tplString = $tpl->get();
|
|
|
22 |
|
|
|
23 |
//
|
|
|
24 |
// the actual translate stuff
|
|
|
25 |
//
|
|
|
26 |
require_once( 'I18N/Messages/Translate.php' );
|
|
|
27 |
$db = DB::connect('mysql://root@localhost/test');
|
|
|
28 |
$translate = new I18N_Messages_Translate( $db );
|
|
|
29 |
print $translate->translateMarkUpString( $tplString , $_REQUEST['lang']?$_REQUEST['lang']:'en' );
|
|
|
30 |
|
|
|
31 |
?>
|