24 lines
1.0 KiB
PHP
24 lines
1.0 KiB
PHP
<?php
|
||
$data = json_decode(file_get_contents(__DIR__.'/untranslated_site.json'), true);
|
||
|
||
$turkishOnly = [];
|
||
|
||
function isRealTurkish($text) {
|
||
if (empty($text) || is_numeric($text)) return false;
|
||
// Check for Turkish specific characters or common Turkish words
|
||
return preg_match('/[ğüşıöçĞÜŞİÖÇ]/u', $text) || preg_match('/\b(ve|bir|bu|ne|de|da|icin|için|ile|en|ki|ise|mi|mu|sonra|olarak|gibi|daha|hakkinda|hakkımızda|giris|giriş|kayit|kayıt|bizim|hizmet|iletisim|iletişim|neden|neler|yapıyoruz|biz|seviyoruz|ekibimiz|abone|adınız|soyadınız|telefon|adres|teknoloji)\b/iu', $text);
|
||
}
|
||
|
||
foreach ($data as $item) {
|
||
$trVal = !empty($item['tr']) ? $item['tr'] : $item['key'];
|
||
if (isRealTurkish($trVal)) {
|
||
$turkishOnly[] = [
|
||
'id' => $item['id'],
|
||
'tr' => $trVal
|
||
];
|
||
}
|
||
}
|
||
|
||
file_put_contents(__DIR__.'/unique_turkish_site.json', json_encode($turkishOnly, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||
echo "Found " . count($turkishOnly) . " Turkish site translations that need translation.\n";
|