make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); use App\Models\SiteTranslation; use App\Models\Translation; use App\Models\Language; echo "=== STARTING TRANSLATION PROCESS ===\n"; // Helper translation function using Google Translate single API function translateToEnglish($text) { if (empty($text) || is_numeric($text)) { return $text; } // If it's a HTML tags only or empty paragraph, return as is if (trim($text) === '
' || trim($text) === '') { return $text; } $url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=tr&tl=en&dt=t&q=" . urlencode($text); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"); curl_setopt($ch, CURLOPT_TIMEOUT, 15); $response = curl_exec($ch); curl_close($ch); if (!$response) { return false; } $data = json_decode($response, true); if (!isset($data[0])) { return false; } $translated = ""; foreach ($data[0] as $sentence) { $translated .= $sentence[0]; } return $translated; } // Check for Turkish specific characters or common Turkish words function isTurkishText($text) { if (empty($text) || is_numeric($text)) return false; 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); } // ---------------------------------------------------- // PHASE 1: Translate Dynamic Model Translations // ---------------------------------------------------- echo "\n--- Phase 1: Translating Dynamic Model Translations ---\n"; $trTranslations = Translation::where('language_code', 'tr')->get(); $translatedModelsCount = 0; foreach ($trTranslations as $t) { $trVal = trim($t->field_value); if ($trVal === '' || $trVal === '' || $trVal === 'null') { continue; } $enTranslation = Translation::where('translatable_type', $t->translatable_type) ->where('translatable_id', $t->translatable_id) ->where('field_name', $t->field_name) ->where('language_code', 'en') ->first(); $enVal = $enTranslation ? trim($enTranslation->field_value) : ''; $needsTranslation = false; if (empty($enVal) || $enVal === '') { $needsTranslation = true; } else if ($enVal === $trVal && isTurkishText($trVal)) { $needsTranslation = true; } // Specific exclusions or manual translations if ($needsTranslation) { echo "Translating [{$t->translatable_type} ID: {$t->translatable_id}] Field '{$t->field_name}'...\n"; // Manual override for some specific fields to ensure maximum quality if ($t->translatable_type === 'App\\Models\\Page' && $t->translatable_id == 4 && $t->field_name === 'content') { $translatedVal = '
Our Mission
We work with all our might to create human-oriented, rational, simple, and aesthetic applications that make life easier.
Our Vision
The world\'s greatest country Turkey, and Turkey\'s greatest company Trunçgil!
Our Values
Integrity:
"No legacy is so rich as honesty."
Shakespeare
Entrepreneurship:
"The real voyage of discovery consists not in seeking new landscapes, but in having new eyes."
M. Proust
Responsibility:
"Self-responsibility means keeping the promises we make to ourselves as well as the promises we make to others."
Andre Gide
Quality:
"If a man is called to be a street sweeper, he should sweep streets even as Michelangelo painted, or Beethoven composed music, or Shakespeare wrote poetry. He should sweep streets so well that all the hosts of heaven and earth will pause to say, \'Here lived a great street sweeper who did his job well.\'"
Martin Luther King