Files
my_closet/update_i18n.cjs

212 lines
8.7 KiB
JavaScript

const fs = require('fs');
let code = fs.readFileSync('src/lib/i18n.js', 'utf8');
const newKeys = {
PT: {
createSection: "Criar Secção",
noSectionsCreated: "Ainda não tem secções criadas",
linkCopied: "Link copiado!",
share: "Partilhar",
piecesInLaundry: "peça(s) na lavandaria",
toBeWashed: "A ser lavados",
unavailable: "Indisponíveis",
availableLooks: "Disponíveis",
noLooksAvailable: "Nenhum look disponível",
location: "Localidade",
locationEx: "Ex: Lisboa, Portugal",
ideaSuggestion: "Ideia / Sugestão",
bugError: "Bug / Erro",
writeMessage: "Escreva aqui a sua mensagem...",
sendMessage: "Enviar Mensagem",
notificationsModal: "Notificações",
noNotifications: "Sem Notificações",
userSavedLook: "guardou o seu look",
inTheirCloset: "no armário dele!",
sharedLookTitle: "Look Partilhado",
sharedBy: "Partilhado por",
includedPieces: "Peças incluídas",
ignore: "Ignorar",
copying: "A copiar...",
copyToMyCloset: "Copiar para o meu armário",
msgSentSuccess: "Mensagem enviada com sucesso!",
msgSendError: "Erro ao enviar mensagem. Verifica a tua ligação.",
addFuturePurchase: "Adicionar peça como compra futura",
wishlistDesc: "Lista de Desejos",
someone: "alguém",
feedbackTitle: "Suporte e Feedback",
feedbackDesc: "Tem alguma ideia, sugestão ou encontrou algum problema? Envie uma mensagem diretamente para nós!",
themeColorTitle: "Cor do Tema",
personalizeColorDesc: "Personalize a cor",
saveChanges: "Guardar Alterações"
},
EN: {
createSection: "Create Section",
noSectionsCreated: "No sections created yet",
linkCopied: "Link copied!",
share: "Share",
piecesInLaundry: "piece(s) in laundry",
toBeWashed: "To be washed",
unavailable: "Unavailable",
availableLooks: "Available",
noLooksAvailable: "No look available",
location: "Location",
locationEx: "E.g.: Lisbon, Portugal",
ideaSuggestion: "Idea / Suggestion",
bugError: "Bug / Error",
writeMessage: "Write your message here...",
sendMessage: "Send Message",
notificationsModal: "Notifications",
noNotifications: "No Notifications",
userSavedLook: "saved your look",
inTheirCloset: "in their closet!",
sharedLookTitle: "Shared Look",
sharedBy: "Shared by",
includedPieces: "Included Pieces",
ignore: "Ignore",
copying: "Copying...",
copyToMyCloset: "Copy to my closet",
msgSentSuccess: "Message sent successfully!",
msgSendError: "Error sending message. Check your connection.",
addFuturePurchase: "Add piece as future purchase",
wishlistDesc: "Wishlist",
someone: "someone",
feedbackTitle: "Support and Feedback",
feedbackDesc: "Do you have any ideas, suggestions, or found a problem? Send a message directly to us!",
themeColorTitle: "Theme Color",
personalizeColorDesc: "Personalize the color",
saveChanges: "Save Changes"
},
ES: {
createSection: "Crear Sección",
noSectionsCreated: "Aún no hay secciones creadas",
linkCopied: "¡Enlace copiado!",
share: "Compartir",
piecesInLaundry: "pieza(s) en la lavandería",
toBeWashed: "Por lavar",
unavailable: "No disponibles",
availableLooks: "Disponibles",
noLooksAvailable: "Ningún look disponible",
location: "Ubicación",
locationEx: "Ej: Lisboa, Portugal",
ideaSuggestion: "Idea / Sugerencia",
bugError: "Error / Fallo",
writeMessage: "Escribe aquí tu mensaje...",
sendMessage: "Enviar Mensaje",
notificationsModal: "Notificaciones",
noNotifications: "Sin Notificaciones",
userSavedLook: "guardó tu look",
inTheirCloset: "en su armario!",
sharedLookTitle: "Look Compartido",
sharedBy: "Compartido por",
includedPieces: "Piezas incluidas",
ignore: "Ignorar",
copying: "Copiando...",
copyToMyCloset: "Copiar a mi armario",
msgSentSuccess: "¡Mensaje enviado con éxito!",
msgSendError: "Error al enviar. Revisa tu conexión.",
addFuturePurchase: "Añadir pieza como compra futura",
wishlistDesc: "Lista de Deseos",
someone: "alguien",
feedbackTitle: "Soporte y Comentarios",
feedbackDesc: "¿Tienes alguna idea, sugerencia o encontraste un problema? ¡Envíanos un mensaje directamente!",
themeColorTitle: "Color del Tema",
personalizeColorDesc: "Personaliza el color",
saveChanges: "Guardar Cambios"
},
FR: {
createSection: "Créer une Section",
noSectionsCreated: "Aucune section créée",
linkCopied: "Lien copié !",
share: "Partager",
piecesInLaundry: "pièce(s) à la blanchisserie",
toBeWashed: "À laver",
unavailable: "Indisponibles",
availableLooks: "Disponibles",
noLooksAvailable: "Aucun look disponible",
location: "Emplacement",
locationEx: "Ex: Lisbonne, Portugal",
ideaSuggestion: "Idée / Suggestion",
bugError: "Bug / Erreur",
writeMessage: "Écrivez votre message ici...",
sendMessage: "Envoyer le Message",
notificationsModal: "Notifications",
noNotifications: "Aucune Notification",
userSavedLook: "a sauvegardé votre look",
inTheirCloset: "dans son placard !",
sharedLookTitle: "Look Partagé",
sharedBy: "Partagé par",
includedPieces: "Pièces incluses",
ignore: "Ignorer",
copying: "Copie en cours...",
copyToMyCloset: "Copier dans mon placard",
msgSentSuccess: "Message envoyé avec succès !",
msgSendError: "Erreur d'envoi. Vérifiez votre connexion.",
addFuturePurchase: "Ajouter comme achat futur",
wishlistDesc: "Liste de Souhaits",
someone: "quelqu'un",
feedbackTitle: "Support et Commentaires",
feedbackDesc: "Avez-vous des idées, des suggestions ou trouvé un problème ? Envoyez-nous un message directement !",
themeColorTitle: "Couleur du Thème",
personalizeColorDesc: "Personnaliser la couleur",
saveChanges: "Enregistrer les Modifications"
},
DE: {
createSection: "Bereich erstellen",
noSectionsCreated: "Noch keine Bereiche erstellt",
linkCopied: "Link kopiert!",
share: "Teilen",
piecesInLaundry: "Stück(e) in der Wäsche",
toBeWashed: "Zum Waschen",
unavailable: "Nicht verfügbar",
availableLooks: "Verfügbar",
noLooksAvailable: "Kein Look verfügbar",
location: "Ort",
locationEx: "Z.B.: Lissabon, Portugal",
ideaSuggestion: "Idee / Vorschlag",
bugError: "Fehler / Bug",
writeMessage: "Schreibe hier deine Nachricht...",
sendMessage: "Nachricht Senden",
notificationsModal: "Benachrichtigungen",
noNotifications: "Keine Benachrichtigungen",
userSavedLook: "hat deinen Look gespeichert",
inTheirCloset: "in seinem Schrank!",
sharedLookTitle: "Geteilter Look",
sharedBy: "Geteilt von",
includedPieces: "Enthaltene Stücke",
ignore: "Ignorieren",
copying: "Kopieren...",
copyToMyCloset: "In meinen Schrank kopieren",
msgSentSuccess: "Nachricht erfolgreich gesendet!",
msgSendError: "Fehler beim Senden. Überprüfe deine Verbindung.",
addFuturePurchase: "Als zukünftigen Kauf hinzufügen",
wishlistDesc: "Wunschzettel",
someone: "jemand",
feedbackTitle: "Support und Feedback",
feedbackDesc: "Hast du Ideen, Vorschläge oder ein Problem gefunden? Sende uns direkt eine Nachricht!",
themeColorTitle: "Themenfarbe",
personalizeColorDesc: "Farbe anpassen",
saveChanges: "Änderungen Speichern"
}
};
for (const lang in newKeys) {
const keys = newKeys[lang];
const langRegex = new RegExp(`${lang}: \\{([\\s\\S]*?)\\}`, 'g');
let match = langRegex.exec(code);
if (match) {
let currentKeys = match[1];
let newKeysString = "";
for (const [k, v] of Object.entries(keys)) {
if (!currentKeys.includes(`${k}:`)) {
newKeysString += ` ${k}: "${v}",\n`;
}
}
if (newKeysString.length > 0) {
code = code.replace(currentKeys, currentKeys.trimEnd() + ",\n" + newKeysString);
}
}
}
fs.writeFileSync('src/lib/i18n.js', code);
console.log('i18n.js updated successfully');