Updated to 2.0 version
Second connection method added (if curl library is not installed, script requesting Google server using file_get_contents function). Improved performance.
PHP Translate is a very simple but useful class for dynamic language translations.
Why PHP Translate? 60+ languages support Lightweight and fast This is easy in use Intuitive translation method Google Translate based solution You can define default settings for translations (input encoding, output encoding, input language and output language). You can define individual settings for each translation.
Installation
<?php include('lib/translator.class.php');
$translator = new Translator(); $translation = $translator -> Translate('Witaj ?wiecie', 'pl', 'en');
//this example displays 'Hello World' echo $translation; ?>
Supported languages
Afrikaans (AF) Albanian (SQ) English (EN) Arabic (AR) Azerbaijani (AZ) Bengali (BN) Belarusian (BE) Bulgarian (BG) Croatian (HR) Czech (CS) Danish (DA) Esperanto (EO) Estonian (ET) Filipino (TL) Finnish (FI) French (FR) Galician (GL) Greek (EL) Georgian (KA) Gujarati (GU) Hebrew (IW) Hindi (HI) Spanish (ES) Dutch (NL) Indonesian (ID) Irish (GA) Iceland (IS) Japanese (JA) Yiddish (YI) Kannada (KN) Catalan (CA) Khmer (KM) Korean (KO) Haitan (HT) Lao (LO) Lithuanian (LT) Latin (LA) Latvian (LV) Macedonian (MK) Malay (MS) Maltese (MT) German (DE) Norwegian (NO) Armenian (HY) Persian (FA) Polish (PL) Portuguese (PT) Russian (RU) Romanian (RO) Serbian (SR) Slovak (SK) Slovenian (SL) Swahili (SW) Swedish (SV) Thai (TH) Tamil (TA) Telugu (TE) Turkish (TR) Ukrainian (UK) Urdu (UR) Welsh (CY) Hungarian (HU) Vietnamese (VI) Italian (IT)
Files included
Class file. Demo.
This is a scraping script. Your IP address will get banned if you ping Google translate more than an average user.This problem can be solved by proxy or/and simple cache solution what i can provide.If you plan to send to much translations requests, please contact with me.