zwiicms-translations/tools/check.php

20 lines
823 B
PHP
Raw Normal View History

2022-12-29 10:42:45 +01:00
<?php
2023-01-20 09:51:53 +01:00
$langSource = 'fr_FR';
$langTargetArray = ['en_EN', 'es', 'gr_GR', 'it', 'pt_PT'];
2023-01-24 09:57:43 +01:00
$folderTarget = '../modules/form/';
2023-01-20 09:51:53 +01:00
foreach ($langTargetArray as $key => $langTarget) {
if (file_exists($folderTarget . $langSource . '.json') &&
file_exists($folderTarget . $langTarget . '.json') )
{
$source = json_decode(file_get_contents($folderTarget . $langSource . '.json'), true);
$target = json_decode(file_get_contents($folderTarget . $langTarget . '.json'), true);
$intersec = array_intersect_key($target, $source);
$dif = array_diff_key($source, $target);
$merge = array_merge($dif, $intersec);
file_put_contents($folderTarget . $langTarget . '.json', json_encode($merge, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
echo $langTarget . ' terminé.';
}
2023-01-02 17:52:08 +01:00
2023-01-20 09:51:53 +01:00
}
echo 'Tout est fini.';