-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
24 lines (17 loc) · 914 Bytes
/
example.php
File metadata and controls
24 lines (17 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
require_once 'GoogleTranslator.class.php';
//Translate normally.
$translation = GoogleTranslator::translate('I am fine today.','en', 'cs');
echo $translator;
echo '<hr />';
//Batch translate to a source language
GoogleTranslator::setLanguages('en');
$translation = GoogleTranslator::translate('I am fine today.', false, 'cs'); echo $translation . '<br />';
$translation = GoogleTranslator::translate('I am fine today.', false, 'de'); echo $translation . '<br />';
echo '<hr />';
//Batch translate to a destination language. (Apologies for the Czech translation, could someone please fix this?)
GoogleTranslator::setLanguages(false,'en');
$translation = GoogleTranslator::translate('nazdar', 'cs'); echo $translation . '<br />';
$translation = GoogleTranslator::translate('hallo', 'de'); echo $translation . '<br />';
echo '<hr />';