From 57edfbb7ccdcd70c099e9c76437c48b54823905b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 27 Aug 2025 13:47:32 +0200 Subject: [PATCH] Improve translations context, remove current AI translations --- app/config/locale/translations/de.json | 29 ---------------- app/config/locale/translations/he.json | 29 ---------------- app/config/locale/translations/ne.json | 29 ---------------- app/config/locale/translations/nl.json | 29 ---------------- app/config/locale/translations/pt-br.json | 29 ---------------- app/config/locale/translations/pt-pt.json | 29 ---------------- .../Tasks/DevGenerateTranslations.php | 34 +++++++++++++++++-- 7 files changed, 31 insertions(+), 177 deletions(-) diff --git a/app/config/locale/translations/de.json b/app/config/locale/translations/de.json index 27050e1f08..13b9c1b40a 100644 --- a/app/config/locale/translations/de.json +++ b/app/config/locale/translations/de.json @@ -1,33 +1,4 @@ { - "emails.certificate.signature": "{{project}} Team", - "emails.certificate.thanks": "Danke,", - "emails.certificate.footer": "Ihr vorheriges Zertifikat ist 30 Tage ab dem ersten Fehler gültig. Wir empfehlen dringend, diesen Fall zu untersuchen, da Ihre Domain sonst ohne gültige SSL-Kommunikation bleibt.", - "emails.certificate.body": "Das Zertifikat für Ihre Domain '{{domain}}' konnte nicht erstellt werden. Dies ist Versuch Nr. {{attempt}}, und das Scheitern wurde verursacht durch: {{error}}", - "emails.certificate.hello": "Hallo,", - "emails.certificate.preview": "Die Zertifikatserstellung für die Domain %s ist fehlgeschlagen.", - "emails.certificate.subject": "Zertifikatsfehler für %s", - "emails.invitation.preview": "{{owner}} hat dich eingeladen, dem Team {{team}} im Projekt {{project}} beizutreten.", - "emails.recovery.preview": "Setzen Sie Ihr {{project}} Passwort mithilfe des Links zurück.", - "emails.mfaChallenge.signature": "{{project}} Team", - "emails.mfaChallenge.thanks": "Danke,", - "emails.mfaChallenge.clientInfo": "Dieser Bestätigungscode wurde angefordert über {{b}}{{agentClient}}{{/b}} auf {{b}}{{agentDevice}}{{/b}} {{b}}{{agentOs}}{{/b}}. Wenn Sie den Bestätigungscode nicht angefordert haben, können Sie diese E-Mail sicher ignorieren.", - "emails.mfaChallenge.description": "Geben Sie den folgenden Code ein, um Ihre Zwei-Faktor-Authentifizierung in {{b}}{{project}}{{/b}} zu bestätigen. Dieser Code läuft in 15 Minuten ab.", - "emails.mfaChallenge.hello": "Hallo {{user}},", - "emails.mfaChallenge.preview": "Verwenden Sie den Code {{otp}} für die Zwei-Faktor-Authentifizierung in {{project}}. Er läuft in 15 Minuten ab.", - "emails.mfaChallenge.subject": "Bestätigungscode für {{project}}", - "emails.otpSession.preview": "Verwenden Sie OTP {{otp}} für die Anmeldung bei {{project}}. Läuft in 15 Minuten ab.", - "emails.sessionAlert.signature": "{{project}} Team", - "emails.sessionAlert.thanks": "Danke,", - "emails.sessionAlert.footer": "Falls Sie es waren, brauchen Sie nichts weiter zu tun.\nFalls Sie diese Sitzung nicht initiiert haben oder eine unbefugte Aktivität vermuten, sichern Sie bitte Ihr Konto.", - "emails.sessionAlert.listCountry": "Land: {{b}}{{country}}{{/b}}", - "emails.sessionAlert.listIpAddress": "IP-Adresse: {{b}}{{ipAddress}}{{/b}}", - "emails.sessionAlert.listDevice": "Gerät: {{b}}{{device}}{{/b}}", - "emails.sessionAlert.body": "Eine neue Sitzung wurde auf Ihrem {{b}}{{project}}{{/b}} Konto erstellt, {{b}}am {{date}}, {{year}} um {{time}} UTC{{/b}}. Hier sind die Details der neuen Sitzung:", - "emails.sessionAlert.hello": "Hallo {{user}}, ", - "emails.sessionAlert.preview": "Neue Anmeldung erkannt bei {{project}} um {{time}} UTC.", - "emails.sessionAlert.subject": "Sicherheitswarnung: Neue Sitzung auf Ihrem {{project}}-Konto", - "emails.magicSession.preview": "Melden Sie sich bei {{project}} mit Ihrem sicheren Link an. Läuft in 1 Stunde ab.", - "emails.verification.preview": "Bestätigen Sie Ihre E-Mail, um Ihr {{project}} Konto zu aktivieren.", "settings.inspire": "\"Die Kunst, weise zu sein, ist die Kunst, zu wissen, was zu übersehen ist.\"", "settings.locale": "de", "settings.direction": "ltr", diff --git a/app/config/locale/translations/he.json b/app/config/locale/translations/he.json index 0a156345d7..6eaa21eb99 100644 --- a/app/config/locale/translations/he.json +++ b/app/config/locale/translations/he.json @@ -1,33 +1,4 @@ { - "emails.certificate.signature": "צוות {{project}}", - "emails.certificate.thanks": "תודה,", - "emails.certificate.footer": "האישור הקודם שלך יהיה תקף למשך 30 ימים מהכשלון הראשון. אנו ממליצים בחום לחקור את המקרה הזה, אחרת הדומיין שלך עשוי להיגמר ללא תקשורת SSL תקפה.", - "emails.certificate.body": "לא ניתן היה להפיק תעודה עבור התחום '{{domain}}'. זו הניסיון מספר {{attempt}}, והכישלון נגרם בגלל: {{error}}", - "emails.certificate.hello": "שלום,", - "emails.certificate.preview": "הנפקת תעודת הדומיין %s נכשלה.", - "emails.certificate.subject": "כישלון אישור עבור %s", - "emails.invitation.preview": "{{owner}} הזמין אותך להצטרף ל-{{team}} ב-{{project}}", - "emails.recovery.preview": "אפס את הסיסמה של {{project}} באמצעות הקישור.", - "emails.mfaChallenge.signature": "צוות {{project}}", - "emails.mfaChallenge.thanks": "מודה לך,", - "emails.mfaChallenge.clientInfo": "בקשת קוד האימות הזה נעשתה באמצעות {{b}}{{agentClient}}{{/b}} ב-{{b}}{{agentDevice}}{{/b}} {{b}}{{agentOs}}{{/b}}. אם לא ביקשת את קוד האימות, ניתן להתעלם בבטחה מהדוא\"ל הזה.", - "emails.mfaChallenge.description": "הזן את הקוד הבא כדי לאשר את האימות הדו-שלבי ב-{{b}}{{project}}{{/b}}. קוד זה יפוג בעוד 15 דקות.", - "emails.mfaChallenge.hello": "שלום {{user}},", - "emails.mfaChallenge.preview": "השתמש בקוד {{otp}} לאימות דו-שלבי ב-{{project}}. פג תוקף תוך 15 דקות.", - "emails.mfaChallenge.subject": "קוד האימות עבור {{project}}.", - "emails.otpSession.preview": "השתמש ב-{{otp}} כדי להיכנס ל-{{project}}. פג תוקף בעוד 15 דקות.", - "emails.sessionAlert.signature": "מעבדת {{project}}", - "emails.sessionAlert.thanks": "תודה,", - "emails.sessionAlert.footer": "אם זה היית אתה, אין שום דבר נוסף שעליך לעשות. אם לא התחלת את הסשן הזה או חושד בפעילות לא מורשית, נא הגן על חשבונך.", - "emails.sessionAlert.listCountry": "מדינה: {{b}}{{country}}{{/b}}", - "emails.sessionAlert.listIpAddress": "כתובת IP: {{b}}{{ipAddress}}{{/b}}", - "emails.sessionAlert.listDevice": "מכשיר: {{b}}{{device}}{{/b}}", - "emails.sessionAlert.body": "נוצרה סשן חדשה בחשבון ה-{{b}}{{project}}{{/b}} שלך, {{b}}בתאריך {{date}}, {{year}} בשעה {{time}} UTC{{/b}}.\nלהלן פרטי הסשן החדש:", - "emails.sessionAlert.hello": "שלום {{user}},", - "emails.sessionAlert.preview": "זוהתה התחברות חדשה ב-{{project}} בשעה {{time}} לפי זמן UTC.", - "emails.sessionAlert.subject": "התראת אבטחה: פתיחה של סשן חדש בחשבון {{project}} שלך", - "emails.magicSession.preview": "היכנס ל- {{project}} באמצעות הקישור המאובטח שלך. התוקף יפוג בעוד שעה אחת.", - "emails.verification.preview": "אמת את האימייל שלך כדי להפעיל את החשבון של {{project}}.", "settings.inspire": "\"להיות חכם זה לדעת ממה להתעלם.\"", "settings.locale": "he", "settings.direction": "rtl", diff --git a/app/config/locale/translations/ne.json b/app/config/locale/translations/ne.json index cf3254fba4..06600873ab 100644 --- a/app/config/locale/translations/ne.json +++ b/app/config/locale/translations/ne.json @@ -1,33 +1,4 @@ { - "emails.certificate.signature": "{{project}} टोली", - "emails.certificate.thanks": "धन्यवाद,", - "emails.certificate.footer": "तपाईंको अघिल्लो प्रमाणपत्र पहिलो विफलताबाट ३० दिनसम्म मान्य हुनेछ। हामी यो मामलाको जाँच गर्न अत्यधिक सिफारिस गर्दछौं, अन्यथा तपाईंको डोमेनको वैध SSL संचार बिना रहनेछ।", - "emails.certificate.body": "{{domain}}", - "emails.certificate.hello": "नमस्ते,", - "emails.certificate.preview": "तपाईंको डोमेन %s प्रमाणपत्र उत्पादन असफल भएको छ।", - "emails.certificate.subject": "%s का लागि प्रमाणपत्र असफलता", - "emails.invitation.preview": "{{owner}} सँग जोडिन निमन्त्रणा गरेको छ।", - "emails.recovery.preview": "{{project}} पासवर्ड रिसेट गर्न यो लिंक प्रयोग गर्नुहोस्।", - "emails.mfaChallenge.signature": "{{project}} टोली", - "emails.mfaChallenge.thanks": "धन्यवाद,", - "emails.mfaChallenge.clientInfo": "यो प्रमाणीकरण कोड {{b}}{{/b}} बाट अनुरोध गरिएको थियो। यदि तपाईंले प्रमाणीकरण कोडको अनुरोध गर्नुभएन भने, तपाईले यो इमेललाई सुरक्षित रूपमा बेवास्ता गर्न सक्नुहुन्छ।", - "emails.mfaChallenge.description": " तपाईंको दुई चरणको प्रमाणिकरण पुष्टि गर्नको लागि निम्न कोड प्रवेश गर्नुहोस् {{b}}{{/b}}। यो कोड १५ मिनेटमा म्याद सकिनेछ।", - "emails.mfaChallenge.hello": "नमस्ते {{user}},", - "emails.mfaChallenge.preview": "{{otp}} मा दुई चरणको प्रमाणीकरणको लागि प्रयोग गर्नुहोस्। यो १५ मिनेटमा म्याद समाप्त हुन्छ।", - "emails.mfaChallenge.subject": "{{project}} को लागि प्रमाणिकरण कोड", - "emails.otpSession.preview": "{{otp}} मा साइन इन गर्नुहोस्। १५ मिनेटमा सकिन्छ।", - "emails.sessionAlert.signature": "{{project}} टोली", - "emails.sessionAlert.thanks": "धन्यवाद,", - "emails.sessionAlert.footer": "यदि यो तपाईं हुनुहुन्थ्यो भने, तपाईंको लागि थप केही गर्नु आवश्यक छैन। यदि तपाईंले यो सत्र शुरू गर्नुभएको थिएन वा कुनै अनधिकृत गतिविधि हुनुमा शंका लाग्छ भने, कृपया आफ्नो खाता सुरक्षित गर्नुहोस्।", - "emails.sessionAlert.listCountry": "देश: {{b}}{{/b}}", - "emails.sessionAlert.listIpAddress": "आईपी पता: {{b}}{{/b}}", - "emails.sessionAlert.listDevice": "डिभाइस: {{b}}{{/बि}}", - "emails.sessionAlert.body": "तपाईंको {{b}} UTC{{/b}}।\nयहाँ नयाँ सत्रको विवरणहरू छन्:", - "emails.sessionAlert.hello": "नमस्कार {{user}}, ", - "emails.sessionAlert.preview": "{{project}} UTCमा नयाँ लगइन पत्ता लाग्यो।", - "emails.sessionAlert.subject": "सुरक्षाको चिन्ता: तपाईंको {{project}} खातामा नयाँ सत्र सुरु भएको छ।", - "emails.magicSession.preview": "{{project}} मा आफ्नो सुरक्षित लिंकद्वारा साइन इन गर्नुहोस्। १ घण्टामा अवतरण मिति सकिन्छ।", - "emails.verification.preview": "तपाईंको {{project}} खाता सक्रिय गर्नको लागि आफ्नो ईमेल प्रमाणित गर्नुहोस्।", "settings.inspire": "\"के लाई बेवास्ता गर्ने भन्ने जान्नुनै बुद्धिमान हुनुको कला हो ।\"", "settings.locale": "ne", "settings.direction": "ltr", diff --git a/app/config/locale/translations/nl.json b/app/config/locale/translations/nl.json index fd71c48e7b..c8cf5be1ea 100644 --- a/app/config/locale/translations/nl.json +++ b/app/config/locale/translations/nl.json @@ -1,33 +1,4 @@ { - "emails.certificate.signature": "{{project}} team", - "emails.certificate.thanks": "Dank je,", - "emails.certificate.footer": "Uw vorige certificaat is nog 30 dagen geldig sinds de eerste fout. We raden sterk aan om dit geval te onderzoeken, anders zal uw domein zonder geldige SSL-communicatie eindigen.", - "emails.certificate.body": "Het certificaat voor uw domein '{{domain}}' kon niet worden gegenereerd. Dit is poging nummer {{attempt}}, en de mislukking werd veroorzaakt door: {{error}}", - "emails.certificate.hello": "Hallo,", - "emails.certificate.preview": "De certificaatgeneratie van uw domein %s is mislukt.", - "emails.certificate.subject": "Certificaatfout voor %s", - "emails.invitation.preview": "{{owner}} heeft je uitgenodigd om {{team}} te joinen bij {{project}}.", - "emails.recovery.preview": "Reset je {{project}} wachtwoord met behulp van de link.", - "emails.mfaChallenge.signature": "{{project}} team", - "emails.mfaChallenge.thanks": "Dank je,", - "emails.mfaChallenge.clientInfo": "Deze verificatiecode is aangevraagd door gebruik te maken van {{b}}{{agentClient}}{{/b}} op {{b}}{{agentDevice}}{{/b}} {{b}}{{agentOs}}{{/b}}. Als u de verificatiecode niet heeft aangevraagd, kunt u deze email veilig negeren.", - "emails.mfaChallenge.description": "Voer de volgende code in om uw tweestapsverificatie te bevestigen in {{b}}{{project}}{{/b}}. Deze code vervalt over 15 minuten.", - "emails.mfaChallenge.hello": "Hallo {{user}},", - "emails.mfaChallenge.preview": "Gebruik code {{otp}} voor verificatie in twee stappen in {{project}}. Vervalt over 15 minuten.", - "emails.mfaChallenge.subject": "Verificatiecode voor {{project}}", - "emails.otpSession.preview": "Gebruik OTP {{otp}} om in te loggen op {{project}}. Verloopt over 15 minuten.", - "emails.sessionAlert.signature": "{{project}} team", - "emails.sessionAlert.thanks": "Dank je,", - "emails.sessionAlert.footer": "Als u dit was, hoeft u niets meer te doen. Als u deze sessie niet heeft geïnitieerd of vermoedt dat er ongeoorloofde activiteiten plaatsvinden, beveilig dan uw account.", - "emails.sessionAlert.listCountry": "Land: {{b}}{{country}}{{/b}}", - "emails.sessionAlert.listIpAddress": "IP Adres: {{b}}{{ipAddress}}{{/b}}", - "emails.sessionAlert.listDevice": "Apparaat: {{b}}{{device}}{{/b}}", - "emails.sessionAlert.body": "Er is een nieuwe sessie aangemaakt op je {{b}}{{project}}{{/b}} account, {{b}}op {{date}}, {{year}} om {{time}} UTC{{/b}}. Hier zijn de details van de nieuwe sessie:", - "emails.sessionAlert.hello": "Hallo {{user}},", - "emails.sessionAlert.preview": "Nieuw inloggen gedetecteerd op {{project}} om {{time}} UTC.", - "emails.sessionAlert.subject": "Beveiligingswaarschuwing: nieuwe sessie op uw {{project}} account", - "emails.magicSession.preview": "Log in bij {{project}} met je beveiligde link. Verloopt over 1 uur.", - "emails.verification.preview": "Verifieer uw e-mailadres om uw {{project}} account te activeren.", "settings.inspire": "\"De kunst om wijs te zijn is de kunst om te weten wat over het hoofd gezien moet worden.\"", "settings.locale": "nl", "settings.direction": "ltr", diff --git a/app/config/locale/translations/pt-br.json b/app/config/locale/translations/pt-br.json index e640db295c..4b182e306e 100644 --- a/app/config/locale/translations/pt-br.json +++ b/app/config/locale/translations/pt-br.json @@ -1,33 +1,4 @@ { - "emails.certificate.signature": "{{project}} equipe", - "emails.certificate.thanks": "Obrigado,", - "emails.certificate.footer": "Seu certificado anterior será válido por 30 dias a partir da primeira falha. Recomendamos fortemente investigar este caso, caso contrário, seu domínio ficará sem uma comunicação SSL válida.", - "emails.certificate.body": "O certificado para o seu domínio '{{domain}}' não pôde ser gerado. Esta é a tentativa nº {{attempt}}, e a falha foi causada por: {{error}}.", - "emails.certificate.hello": "Olá,", - "emails.certificate.preview": "A geração do certificado do seu domínio %s falhou.", - "emails.certificate.subject": "Falha de certificado para %s", - "emails.invitation.preview": "{{owner}} convidou você para se juntar à {{team}} em {{project}}", - "emails.recovery.preview": "Redefina sua senha do {{project}} usando o link.", - "emails.mfaChallenge.signature": "{{project}} equipe", - "emails.mfaChallenge.thanks": "Obrigado,", - "emails.mfaChallenge.clientInfo": "Este código de verificação foi solicitado usando {{b}}{{agentClient}}{{/b}} em {{b}}{{agentDevice}}{{/b}} {{b}}{{agentOs}}{{/b}}. Se você não solicitou o código de verificação, pode ignorar este e-mail com segurança.", - "emails.mfaChallenge.description": "Digite o seguinte código para confirmar sua verificação em duas etapas em {{b}}{{project}}{{/b}}. Este código expirará em 15 minutos.", - "emails.mfaChallenge.hello": "Olá {{user}},", - "emails.mfaChallenge.preview": "Use o código {{otp}} para a verificação em duas etapas no {{project}}. Expira em 15 minutos.", - "emails.mfaChallenge.subject": "Código de Verificação para {{project}}", - "emails.otpSession.preview": "Use o OTP {{otp}} para entrar no {{project}}. Expira em 15 minutos.", - "emails.sessionAlert.signature": "{{project}} equipe", - "emails.sessionAlert.thanks": "Obrigado,", - "emails.sessionAlert.footer": "Se foi você, não há mais nada que precise fazer.\nSe você não iniciou esta sessão ou suspeita de qualquer atividade não autorizada, por favor, proteja sua conta.", - "emails.sessionAlert.listCountry": "País: {{b}}{{country}}{{/b}}", - "emails.sessionAlert.listIpAddress": "Endereço IP: {{b}}{{ipAddress}}{{/b}}", - "emails.sessionAlert.listDevice": "Dispositivo: {{b}}{{device}}{{/b}}", - "emails.sessionAlert.body": "Uma nova sessão foi criada na sua conta {{b}}{{project}}{{/b}}, {{b}}em {{date}}, {{year}} às {{time}} UTC{{/b}}.\\nAqui estão os detalhes da nova sessão:", - "emails.sessionAlert.hello": "Olá {{user}}, ", - "emails.sessionAlert.preview": "Novo login detectado em {{project}} às {{time}} UTC.", - "emails.sessionAlert.subject": "Alerta de segurança: nova sessão na sua conta {{project}}", - "emails.magicSession.preview": "Faça login no {{project}} com seu link seguro. Expira em 1 hora.", - "emails.verification.preview": "Verifique seu email para ativar sua conta {{project}}.", "settings.inspire": "\"A arte de ser sábio é a arte de saber o que deixar passar.\"", "settings.locale": "pt-br", "settings.direction": "ltr", diff --git a/app/config/locale/translations/pt-pt.json b/app/config/locale/translations/pt-pt.json index 3d565c33ca..6dc8aa793c 100644 --- a/app/config/locale/translations/pt-pt.json +++ b/app/config/locale/translations/pt-pt.json @@ -1,33 +1,4 @@ { - "emails.certificate.signature": "equipa do {{project}}", - "emails.certificate.thanks": "Obrigado,", - "emails.certificate.footer": "O seu certificado anterior será válido por 30 dias desde a primeira falha. Recomendamos fortemente que investigue este caso, caso contrário, o seu domínio ficará sem uma comunicação SSL válida.", - "emails.certificate.body": "Certificado para o seu domínio '{{domain}}' não pôde ser gerado. Este é a tentativa n.º {{attempt}}, e a falha foi causada por: {{error}}", - "emails.certificate.hello": "Olá,", - "emails.certificate.preview": "A geração do certificado para o seu domínio %s falhou.", - "emails.certificate.subject": "Falha de certificado para %s", - "emails.invitation.preview": "{{owner}} convidou-o a juntar-se à {{team}} em {{project}}", - "emails.recovery.preview": "Redefina a sua palavra-passe de {{project}} usando o link.", - "emails.mfaChallenge.signature": "{{project}} equipa", - "emails.mfaChallenge.thanks": "Obrigado,", - "emails.mfaChallenge.clientInfo": "Este código de verificação foi solicitado usando {{b}}{{agentClient}}{{/b}} em {{b}}{{agentDevice}}{{/b}} {{b}}{{agentOs}}{{/b}}. Se não solicitou o código de verificação, pode ignorar esta mensagem em segurança.", - "emails.mfaChallenge.description": "Introduza o seguinte código para confirmar a sua verificação em duas etapas em {{b}}{{project}}{{/b}}. Este código irá expirar em 15 minutos.", - "emails.mfaChallenge.hello": "Olá {{user}}, \n", - "emails.mfaChallenge.preview": "Utilize o código {{otp}} para a verificação em dois passos no {{project}}. Expira em 15 minutos.", - "emails.mfaChallenge.subject": "Código de Verificação para {{project}}", - "emails.otpSession.preview": "Utilize o OTP {{otp}} para iniciar sessão no {{project}}. Expira em 15 minutos.", - "emails.sessionAlert.signature": "{{project}} equipa", - "emails.sessionAlert.thanks": "Obrigado,", - "emails.sessionAlert.footer": "Se este foi o seu caso, não há mais nada que precise fazer.\nSe não iniciou esta sessão ou suspeitar de alguma atividade não autorizada, por favor, proteja a sua conta.", - "emails.sessionAlert.listCountry": "País: {{b}}{{country}}{{/b}}", - "emails.sessionAlert.listIpAddress": "Endereço IP: {{b}}{{ipAddress}}{{/b}}", - "emails.sessionAlert.listDevice": "Dispositivo: {{b}}{{device}}{{/b}}", - "emails.sessionAlert.body": "Uma nova sessão foi criada na sua conta {{b}}{{project}}{{/b}}, {{b}}no dia {{date}}, {{year}} às {{time}} UTC{{/b}}.\nAqui estão os detalhes da nova sessão:", - "emails.sessionAlert.hello": "Olá {{user}},", - "emails.sessionAlert.preview": "Novo início de sessão detectado no {{project}} às {{time}} UTC.", - "emails.sessionAlert.subject": "Alerta de segurança: nova sessão na sua conta de {{project}}", - "emails.magicSession.preview": "Inicie sessão no {{project}} com o seu link seguro. Expira em 1 hora.", - "emails.verification.preview": "Verifique o seu email para ativar a sua conta {{project}}.", "settings.inspire": "\"A arte de ser sábio é a arte de saber o que ultrapassar.\"", "settings.locale": "pt-pt", "settings.direction": "ltr", diff --git a/src/Appwrite/Platform/Tasks/DevGenerateTranslations.php b/src/Appwrite/Platform/Tasks/DevGenerateTranslations.php index 80f77bd415..31b7df0954 100644 --- a/src/Appwrite/Platform/Tasks/DevGenerateTranslations.php +++ b/src/Appwrite/Platform/Tasks/DevGenerateTranslations.php @@ -17,6 +17,13 @@ use Utopia\Validator\Text; class DevGenerateTranslations extends Action { + public const TRUSTED_TRANSLATIONS = [ + 'en.json', + 'es.json', + 'fr.json', + 'de.json' + ]; + public static function getName(): string { return 'dev-generate-translations'; @@ -89,7 +96,20 @@ class DevGenerateTranslations extends Action foreach ($missingKeys as $missingKey) { $json = \json_decode(\file_get_contents($dir . '/' . $file), true); - $translation = $this->generateTranslation($language, $mainJson[$missingKey], $apiKey); + $translations = []; + + foreach (self::TRUSTED_TRANSLATIONS as $file) { + $trustedJson = \json_decode(\file_get_contents($dir . '/' . $file), true); + if (\array_key_exists($missingKey, $trustedJson)) { + $translations[$language] = $trustedJson[$missingKey]; + } + } + + if (empty($translations)) { + throw new \Exception('No current translations found in trusted languages for key ' . $missingKey); + } + + $translation = $this->generateTranslation($missingKey, $language, $translations, $apiKey); Console::log('Translation results:'); Console::log('English: ' . $mainJson[$missingKey]); @@ -116,7 +136,7 @@ class DevGenerateTranslations extends Action Console::info("Done. Processed {$filesProcessed} files and {$keysProcessed} keys."); } - private function generateTranslation(string $targetLanguage, string $enTranslation, string $apiKey): string + private function generateTranslation(string $translationKey, string $targetLanguage, array $translations, string $apiKey): string { // Replace placeholders with to prevent AI from translating them, but still provide context $placeholders = []; @@ -152,9 +172,17 @@ class DevGenerateTranslations extends Action $user = new User('user', 'Translator'); $assistant = new Assistant('assistant', 'System'); + $formattedTranslations = \array_map(function ($lang) use ($translations) { + return $lang . ': ' . $translations[$lang]; + }, \array_keys($translations)); + $conversation = new Conversation($agent); $conversation - ->message($assistant, new AgentText('User will give you a message in English language, and you will translate it into ' . $targetLanguage . ' language. Do not translate XML tags, HTML tags, or placeholders - preserve those in the same place in the new message.')) + ->message($assistant, new AgentText('Task instructions: User will give you a message in English language, and you will translate it into ' . $targetLanguage . ' language. Do not translate XML tags, HTML tags, or placeholders - preserve those in the same place in the new message.')) + ->message($assistant, new AgentText('Additional details for context: You are creating translation for key ' . $translationKey)) + ->message($assistant, new AgentText('Translation help: Here is same text translated into some other languages, for more grammar context: ' . \implode(",\n", $formattedTranslations))) + ->message($assistant, new AgentText('Background: You are providing translations service. You are creating translations for Appwrite, a backend as a service platform. It is platform like Supabase, Firebase, NHost or Backendless. Services provided by Appwrite are Auth (teams, permissions, oauth, security), Databases (collections, documents), Tables (rows, columns), Storage (buckets, files), Functions (triggers, events, webhooks, deployments, domains), and more.')) + ->message($user, new AgentText($enTranslation)); $output = $conversation->send()->getContent();