| 1 |
lars |
1 |
<html>
|
|
|
2 |
<body>
|
|
|
3 |
<font color="red">
|
|
|
4 |
please get the sql-file from
|
|
|
5 |
<a href="http://wolfram.kriesing.de/libs/php/SimpleTemplate/examples/translate.sql">here</a>
|
|
|
6 |
to make the translate-method work properly<br>
|
|
|
7 |
this example requires >=PHP 4.1
|
|
|
8 |
</font>
|
|
|
9 |
<br><br>
|
|
|
10 |
|
|
|
11 |
<?php
|
|
|
12 |
|
|
|
13 |
ini_set('include_path',ini_get('include_path').':../..');
|
|
|
14 |
|
|
|
15 |
/**
|
|
|
16 |
*
|
|
|
17 |
* test of I18N_Message_Common
|
|
|
18 |
*
|
|
|
19 |
*/
|
|
|
20 |
print '<h1>TEST I18N_Messages_Common</h1>';
|
|
|
21 |
require_once( 'I18N/Messages/Common.php' );
|
|
|
22 |
|
|
|
23 |
$strings[] = 'This is a test for all of you out there!';
|
|
|
24 |
$strings[] = 'Das ist ein Test für Euch alle da draussen!';
|
|
|
25 |
$strings[] = 'Esto es una prueba para todos vosotros ahi!';
|
|
|
26 |
$strings[] = 'je tu il elle nous vous - need french input here :-)';
|
|
|
27 |
$strings[] = 'Questo è un test per tutti voi là fuori!';
|
|
|
28 |
$strings[] = 'PHP ró?ni si? od skryptów wykonywanych po stronie klienta takich jak np.';
|
|
|
29 |
|
|
|
30 |
foreach( $strings as $aString )
|
|
|
31 |
print "<b>$aString</b> --- seems to be of the language: <b>".I18N_Messages_Common::determineLanguage($aString).'</b><br>';
|
|
|
32 |
|
|
|
33 |
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
|
|
34 |
echo 'determine language of:<input name="langString" size="50" ';
|
|
|
35 |
echo 'value="'.(isset($_REQUEST['langString'])?$_REQUEST['langString']:'What language is this?').'">';
|
|
|
36 |
echo '<input type="submit"><br>';
|
|
|
37 |
if( $_REQUEST['langString'] )
|
|
|
38 |
{
|
|
|
39 |
echo 'I18N_Messages_Common::determineLanguage says it is: <b>';
|
|
|
40 |
echo I18N_Messages_Common::determineLanguage($_REQUEST['langString']).'</b>';
|
|
|
41 |
}
|
|
|
42 |
echo "</form>";
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
*
|
|
|
47 |
* test of Message_Translate
|
|
|
48 |
*
|
|
|
49 |
* DB file: http://wolfram.kriesing.de/libs/php/examples/SimpleTemplate/translate.sql
|
|
|
50 |
*
|
|
|
51 |
*/
|
|
|
52 |
print '<h1>TEST I18N_Messages_Translate</h1>';
|
|
|
53 |
require_once( 'I18N/Messages/Translate.php' );
|
|
|
54 |
|
|
|
55 |
$translate = new I18N_Messages_Translate( 'mysql://root@localhost/test' );
|
|
|
56 |
|
|
|
57 |
$translated[] = $translate->simpleTranslate( 'source code' , 'de' );
|
|
|
58 |
$translated[] = $translate->translate( 'translate (i.e. into ($someVar-or any other string))' , 'de' );
|
|
|
59 |
$translated[] = $translate->translateMarkUpString( $input , 'de' );
|
|
|
60 |
|
|
|
61 |
foreach( $translated as $aTrans )
|
|
|
62 |
print "$aTrans<br>";
|
|
|
63 |
|
|
|
64 |
print_r( $translate->getAll( 'de' ) );
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
?>
|
|
|
68 |
</body>
|
|
|
69 |
</html>
|
|
|
70 |
|