2023-01-24 16:38:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
$langSource = 'fr_FR';
|
2023-02-14 10:46:06 +01:00
|
|
|
$langTarget = 'de';
|
|
|
|
$folderTargetArray = ['../',
|
|
|
|
/*
|
2023-01-24 16:38:28 +01:00
|
|
|
'../modules/blog/',
|
|
|
|
'../modules/news/',
|
|
|
|
'../modules/form/',
|
|
|
|
'../modules/gallery/',
|
|
|
|
'../modules/redirection/',
|
|
|
|
'../modules/search/',
|
2023-02-14 10:46:06 +01:00
|
|
|
*/
|
2023-01-24 16:38:28 +01:00
|
|
|
];
|
|
|
|
foreach ($folderTargetArray as $keyFolder => $folderTarget) {
|
|
|
|
if (file_exists($folderTarget . $langSource . '.json')) {
|
|
|
|
$sourceData = json_decode(file_get_contents($folderTarget . $langSource . '.json'), true);
|
|
|
|
foreach ($sourceData as $originText => $targetText) {
|
|
|
|
$arrayjson = json_decode(file_get_contents('https://clients5.google.com/translate_a/t?client=dict-chrome-ex&sl=auto&tl=' . $langTarget . '&q=' . rawurlencode($originText)), true);
|
|
|
|
$targetData[$originText] = $arrayjson[0][0];
|
|
|
|
}
|
|
|
|
file_put_contents($folderTarget . $langTarget . '.json', json_encode($targetData, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
|
|
|
|
echo $folderTarget . ' Done...';
|
|
|
|
$targetData = [];
|
|
|
|
}
|
|
|
|
}
|