From e02b18e17fdb90c06cb26878b6e3bd431701af1d Mon Sep 17 00:00:00 2001 From: sebseb7 Date: Wed, 16 Jul 2025 08:24:09 +0200 Subject: [PATCH] Refactor translation files and update import syntax: Converted CommonJS to ES module syntax in translate-i18n.js. Enhanced English translation file with new phrases for profile, order summary, and settings sections, while improving existing translations for clarity and consistency. --- src/i18n/locales/en/translation.js | 114 +++++++++++++++++++---------- translate-i18n.js | 10 +-- 2 files changed, 81 insertions(+), 43 deletions(-) diff --git a/src/i18n/locales/en/translation.js b/src/i18n/locales/en/translation.js index aafaab0..2d300fd 100644 --- a/src/i18n/locales/en/translation.js +++ b/src/i18n/locales/en/translation.js @@ -28,6 +28,7 @@ export default { "newPasswordMinLength": "The new password must be at least 8 characters long", // Das neue Passwort muss mindestens 8 Zeichen lang sein "menu": { "profile": "Profile", // Profil + "myProfile": "My profile", // Mein Profil "checkout": "Checkout", // Bestellabschluss "orders": "Orders", // Bestellungen "settings": "Settings", // Einstellungen @@ -42,7 +43,9 @@ export default { "preorderCutting": "Preorder as cutting", // Als Steckling vorbestellen "continueShopping": "Continue shopping", // Weiter einkaufen "proceedToCheckout": "Proceed to checkout", // Weiter zur Kasse - "productCount": "{{count}} {{count, plural, one {Product} other {Products}}}", // {{count}} {{count, plural, one {Produkt} other {Produkte}}} + "productCount": "{{count}} {{count, plural, one {product} other {products}}}", // {{count}} {{count, plural, one {Produkt} other {Produkte}}} + "productSingular": "Product", // Produkt + "productPlural": "Products", // Produkte "removeFromCart": "Remove from cart", // Aus dem Warenkorb entfernen "openCart": "Open cart", // Warenkorb öffnen "availableFrom": "Available from {{date}}", // Ab {{date}} @@ -69,9 +72,9 @@ export default { "priceUnit": "{{price}}/{{unit}}", // {{price}}/{{unit}} "new": "New", // Neu "arriving": "Arriving:", // Ankunft: - "inclVatFooter": "incl. {{vat}}% VAT,*", // incl. {{vat}}% USt.,* + "inclVatFooter": "incl. {{vat}}% VAT,*", // inkl. {{vat}}% MwSt.,* "availability": "Availability", // Verfügbarkeit - "inStock": "in stock", // auf Lager + "inStock": "In stock", // auf Lager "comingSoon": "Coming soon", // Bald verfügbar "deliveryTime": "Delivery time", // Lieferzeit "inclShort": "incl.", // inkl. @@ -81,7 +84,8 @@ export default { "oneProduct": "1 product", // 1 Produkt "multipleProducts": "{{count}} products", // {{count}} Produkte "filteredProducts": "{{filtered}} of {{total}} products", // {{filtered}} von {{total}} Produkten - "filteredOneProduct": "{{filtered}} of 1 product" // {{filtered}} von 1 Produkt + "filteredOneProduct": "{{filtered}} of 1 product", // {{filtered}} von 1 Produkt + "xOfYProducts": "{{x}} of {{y}} products" // {{x}} von {{y}} Produkten }, "removeFiltersToSee": "Remove filters to see products", // Entferne Filter um Produkte zu sehen "outOfStock": "Out of stock", // Out of Stock @@ -112,7 +116,8 @@ export default { "standard": "Standard shipping", // Standardversand "standardFree": "Standard shipping - FREE from €100 order value!", // Standardversand - KOSTENLOS ab 100€ Warenwert! "notAvailable": "Not selectable because one or more items can only be picked up", // nicht auswählbar weil ein oder mehrere Artikel nur abgeholt werden können - "bulky": "For large and heavy items" // Für große und schwere Artikel + "bulky": "For large and heavy items", // Für große und schwere Artikel + "pickupOnly": "Pickup only" // nur Abholung }, "prices": { "free": "free", // kostenlos @@ -134,12 +139,16 @@ export default { "pickupDate": "For which date do you want to pick up the cuttings?", // Für welchen Termin ist die Abholung der Stecklinge gewünscht? "note": "Note", // Anmerkung "sameAddress": "Delivery address is the same as invoice address", // Lieferadresse ist identisch mit Rechnungsadresse - "termsAccept": "I have read the Terms and Conditions, Privacy Policy, and the Right of Withdrawal information" // Ich habe die AGBs, die Datenschutzerklärung und die Bestimmungen zum Widerrufsrecht gelesen + "termsAccept": "I have read the Terms & Conditions, Privacy Policy, and the Right of Withdrawal information", // Ich habe die AGBs, die Datenschutzerklärung und die Bestimmungen zum Widerrufsrecht gelesen + "selectDeliveryMethod": "Select shipping method", // Versandart wählen + "selectPaymentMethod": "Select payment method", // Zahlungsart wählen + "orderSummary": "Order summary", // Bestellübersicht + "addressValidationError": "Please check your entries in the address fields." // Bitte überprüfen Sie Ihre Eingaben in den Adressfeldern. }, "payment": { "successful": "Payment successful!", // Zahlung erfolgreich! "failed": "Payment failed", // Zahlung fehlgeschlagen - "orderCompleted": "🎉 Your order has been successfully completed! You can now view your orders.", // 🎉 Ihre Bestellung wurde erfolgreich abgeschlossen! Sie können jetzt Ihre Bestellungen einsehen. + "orderCompleted": "🎉 Your order was completed successfully! You can now view your orders.", // 🎉 Ihre Bestellung wurde erfolgreich abgeschlossen! Sie können jetzt Ihre Bestellungen einsehen. "orderProcessing": "Your payment was processed successfully. The order will be completed automatically.", // Ihre Zahlung wurde erfolgreich verarbeitet. Die Bestellung wird automatisch abgeschlossen. "paymentError": "Your payment could not be processed. Please try again or choose another payment method.", // Ihre Zahlung konnte nicht verarbeitet werden. Bitte versuchen Sie es erneut oder wählen Sie eine andere Zahlungsmethode. "viewOrders": "View my orders" // Zu meinen Bestellungen @@ -148,30 +157,34 @@ export default { "sorting": "Sorting", // Sortierung "perPage": "per page", // pro Seite "availability": "Availability", // Verfügbarkeit - "manufacturer": "Manufacturer" // Hersteller + "manufacturer": "Manufacturer", // Hersteller + "all": "All" // Alle }, "tax": { - "vat": "Value Added Tax", // Mehrwertsteuer - "vat7": "7% Value Added Tax", // 7% Mehrwertsteuer - "vat19": "19% Value Added Tax", // 19% Mehrwertsteuer - "vat19WithShipping": "19% Value Added Tax (incl. shipping)", // 19% Mehrwertsteuer (inkl. Versand) + "vat": "Value added tax", // Mehrwertsteuer + "vat7": "7% value added tax", // 7% Mehrwertsteuer + "vat19": "19% value added tax", // 19% Mehrwertsteuer + "vat19WithShipping": "19% value added tax (incl. shipping)", // 19% Mehrwertsteuer (inkl. Versand) "totalNet": "Total net price", // Gesamtnettopreis "totalGross": "Total gross price excluding shipping", // Gesamtbruttopreis ohne Versand - "subtotal": "Subtotal" // Zwischensumme + "subtotal": "Subtotal", // Zwischensumme + "incl7Vat": "incl. 7% VAT", // inkl. 7% MwSt. + "inclVatWithFooter": "(incl. {{vat}}% VAT,*)", // (incl. {{vat}}% USt.,*) + "inclVatAmount": "incl. {{amount}} € VAT ({{rate}}%)" // nkl. {{amount}} € MwSt. ({{rate}}%) }, "footer": { "hours": "Sat 11-19", // Sa 11-19 "address": "Trachenberger Straße 14 - Dresden", // Trachenberger Straße 14 - Dresden "location": "Between Pieschen stop and Trachenberger Platz", // Zwischen Haltepunkt Pieschen und Trachenberger Platz - "allPricesIncl": "* All prices incl. legal VAT, plus shipping", // * Alle Preise inkl. gesetzlicher USt., zzgl. Versand + "allPricesIncl": "* All prices incl. statutory VAT, plus shipping", // * Alle Preise inkl. gesetzlicher USt., zzgl. Versand "copyright": "© {{year}} GrowHeads.de", // © {{year}} GrowHeads.de "legal": { "datenschutz": "Privacy", // Datenschutz "agb": "Terms & Conditions", // AGB "sitemap": "Sitemap", // Sitemap "impressum": "Imprint", // Impressum - "batteriegesetzhinweise": "Battery Act Notes", // Batteriegesetzhinweise - "widerrufsrecht": "Right of Withdrawal" // Widerrufsrecht + "batteriegesetzhinweise": "Battery law notes", // Batteriegesetzhinweise + "widerrufsrecht": "Right of withdrawal" // Widerrufsrecht } }, "titles": { @@ -183,7 +196,7 @@ export default { "seeds": "Seeds", // Seeds "stecklinge": "Cuttings", // Stecklinge "oilPress": "Borrow oil press", // Ölpresse ausleihen - "thcTest": "THC Test", // THC Test + "thcTest": "THC test", // THC Test "address1": "Trachenberger Straße 14", // Trachenberger Straße 14 "address2": "01129 Dresden" // 01129 Dresden }, @@ -193,7 +206,7 @@ export default { "comingSoon": "Content coming soon..." // Inhalt kommt bald... }, "thcTest": { - "title": "THC Test", // THC Test + "title": "THC test", // THC Test "comingSoon": "Content coming soon..." // Inhalt kommt bald... } }, @@ -208,24 +221,49 @@ export default { "return": "Return", // Retoure "partialReturn": "Partial return", // Teil Retoure "partialDelivered": "Partially delivered" // Teil geliefert - } + }, + "table": { + "orderNumber": "Order number", // Bestellnummer + "date": "Date", // Datum + "status": "Status", // Status + "items": "Items", // Artikel + "total": "Total", // Summe + "actions": "Actions", // Aktionen + "viewDetails": "View details" // Details anzeigen + }, + "noOrders": "You have not placed any orders yet." // Sie haben noch keine Bestellungen aufgegeben. }, - "common": { - "loading": "Loading...", // Lädt... - "error": "Error", // Fehler - "close": "Close", // Schließen - "save": "Save", // Speichern - "cancel": "Cancel", // Abbrechen - "ok": "OK", // OK - "yes": "Yes", // Ja - "no": "No", // Nein - "next": "Next", // Weiter - "back": "Back", // Zurück - "edit": "Edit", // Bearbeiten - "delete": "Delete", // Löschen - "add": "Add", // Hinzufügen - "remove": "Remove", // Entfernen - "products": "Products", // Produkte - "product": "Product" // Produkt - } -}; + "settings": { + "changePassword": "Change password", // Passwort ändern + "currentPassword": "Current password", // Aktuelles Passwort + "newPassword": "New password", // Neues Passwort + "confirmNewPassword": "Confirm new password", // Neues Passwort bestätigen + "updatePassword": "Update password", // Passwort aktualisieren + "changeEmail": "Change email address", // E-Mail-Adresse ändern + "password": "Password", // Passwort + "newEmail": "New email address", // Neue E-Mail-Adresse + "updateEmail": "Update email", // E-Mail aktualisieren + "apiKey": "API key", // API-Schlüssel + "apiKeyDescription": "Use your API key for integration with external applications.", // Verwenden Sie Ihren API-Schlüssel für die Integration mit externen Anwendungen. + "apiDocumentation": "API documentation:", // API-Dokumentation: + "copyToClipboard": "Copy to clipboard", // In Zwischenablage kopieren + "generate": "Generate", // Generieren + "regenerate": "Regenerate", // Regenerieren + "apiKeyCopied": "API key copied to clipboard", // API-Schlüssel in Zwischenablage kopiert + "errors": { + "fillAllFields": "Please fill in all fields", // Bitte füllen Sie alle Felder aus + "passwordsNotMatch": "The new passwords do not match", // Die neuen Passwörter stimmen nicht überein + "passwordTooShort": "The new password must be at least 8 characters long", // Das neue Passwort muss mindestens 8 Zeichen lang sein + "passwordUpdateError": "Error updating password", // Fehler beim Aktualisieren des Passworts + "invalidEmail": "Please enter a valid email address", // Bitte geben Sie eine gültige E-Mail-Adresse ein + "emailUpdateError": "Error updating email address", // Fehler beim Aktualisieren der E-Mail-Adresse + "userNotFound": "User not found", // Benutzer nicht gefunden + "apiKeyGenerationError": "Error generating API key" // Fehler beim Generieren des API-Schlüssels + }, + "success": { + "passwordUpdated": "Password updated successfully", // Passwort erfolgreich aktualisiert + "emailUpdated": "Email address updated successfully", // E-Mail-Adresse erfolgreich aktualisiert + "apiKeyGenerated": "API key generated successfully", // API-Schlüssel erfolgreich generiert + "apiKeyWarning": "Store this key securely. For security reasons, it will be hidden in 10 seconds." // Speichern Sie diesen Schlüssel sicher. Er wird aus Sicherheitsgründen in 10 Sekunden ausgeblendet. + } + }; diff --git a/translate-i18n.js b/translate-i18n.js index 7579049..e8dc82a 100755 --- a/translate-i18n.js +++ b/translate-i18n.js @@ -1,8 +1,8 @@ #!/usr/bin/env node -const fs = require('fs'); -const path = require('path'); -const OpenAI = require('openai'); +import fs from 'fs'; +import path from 'path'; +import OpenAI from 'openai'; // Configuration const OPENAI_API_KEY = process.env.OPENAI_API_KEY; @@ -366,11 +366,11 @@ async function main() { } // Run the script -if (require.main === module) { +if (import.meta.url === `file://${process.argv[1]}`) { main(); } -module.exports = { +export { translateToEnglish, translateToOtherLanguages, readTranslationFile,