<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$databaseFile = '../../uploads/geolite/ip.mmdb';
require '../../vendor/autoload.php';

use Google\Cloud\Translate\V2\TranslateClient;

$translate = new TranslateClient([
    'key' => 'AIzaSyC_glMEOPHxXQXSXwETPk0-VLT5Ky7Ixtc'
]);


require_once '../../translation.php';

$file = 'translate_to_estonion_text.txt';


 //$fp = fopen('translate_to_lithuanian_text.txt', 'a');
                                                //opens file in append mode  
                                               
                                                
$count = 0;

foreach($language['lv'] AS $key => $lan)
{
    // Translate text from english to french.
    $result = $translate->translate($lan, [
        'source' => 'lv',
        'target' => 'et'
    ]);
    
    echo '$language["ee"]["' . $key . '"] = "' . $result['text'] . '";';
    echo '<br/>';
   // $write['lt']['Sāc sarunu tiešsaistē'] = 'Palīdzības centrs';
    
    //$data = var_export($write, true);
 
//file_put_contents($file, $data);

     
    
   // echo $result['text'] . "<br/>";
    
   
    $count++;
    
}


//fwrite($fp, print_r($write, true));  
    // exit;

//fclose($fp); 


