From 47b674c94905b0488b0b3af39ab3d29cb15403f1 Mon Sep 17 00:00:00 2001 From: 230419 <230419@epvc.pt> Date: Wed, 29 Apr 2026 02:05:56 +0100 Subject: [PATCH] =?UTF-8?q?remo=C3=A7=C3=A3o=20de=20frase=20e=20sintonia?= =?UTF-8?q?=20de=20idioma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fix_app.cjs | 45 +++++++++++ patch_app.cjs | 86 ++++++++++++++++++++ safe_patch.cjs | 85 +++++++++++++++++++ src/App.jsx | 50 ++++++------ src/lib/i18n.js | 195 +++++++++++++++++++++++++++++++++++++++++--- update_i18n.cjs | 211 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 637 insertions(+), 35 deletions(-) create mode 100644 fix_app.cjs create mode 100644 patch_app.cjs create mode 100644 safe_patch.cjs create mode 100644 update_i18n.cjs diff --git a/fix_app.cjs b/fix_app.cjs new file mode 100644 index 0000000..833b41c --- /dev/null +++ b/fix_app.cjs @@ -0,0 +1,45 @@ +const fs = require('fs'); + +let content = fs.readFileSync('src/App.jsx', 'utf8'); +let lines = content.split('\n'); + +// 1312 is index 1311. +// 1327 is index 1326. +// We want to remove from index 1311 up to (but not including) index 1326. +// Count to remove = 1326 - 1311 = 15 lines. + +const newContent = ` +
Selecione pelo menos uma cor
} +{t('laundryMsg')}
`, ``], + + // Create Section + [`{t('addFuturePurchase')}
`], + [`Lista de Desejos`, `{t('wishlistDesc')}`], + + // Settings + [`Tem alguma ideia, sugestão ou encontrou algum problema? Envie uma mensagem diretamente para nós!
`, `{t('feedbackDesc')}
`], + [`Personalize a cor
`, `{t('personalizeColorDesc')}
`], + [`Guardar Alterações`, `{t('saveChanges')}`] +]; + +for (const [oldText, newText] of replacements) { + code = code.split(oldText).join(newText); +} + +// Color map replacement +const colorMapReplace = `['Vermelho', 'Azul', 'Amarelo', 'Verde', 'Laranja', 'Roxo', 'Branco', 'Preto', 'Cinzento', 'Bege'].map(c => (`; +if(code.includes(colorMapReplace)) { + code = code.replace( + colorMapReplace, + `['Vermelho', 'Azul', 'Amarelo', 'Verde', 'Laranja', 'Roxo', 'Branco', 'Preto', 'Cinzento', 'Bege'].map(c => {\n const translatedColor = c === 'Vermelho' ? t('colorRed') : c === 'Azul' ? t('colorBlue') : c === 'Amarelo' ? t('colorYellow') : c === 'Verde' ? t('colorGreen') : c === 'Laranja' ? t('colorOrange') : c === 'Roxo' ? t('colorPurple') : c === 'Branco' ? t('colorWhite') : c === 'Preto' ? t('colorBlack') : c === 'Cinzento' ? t('colorGray') : c === 'Bege' ? t('colorBeige') : c;\n return (` + ); + // Be very precise replacing `{c}` to `{translatedColor}` + code = code.replace( + /className=\{\`px-4 py-2 rounded-xl text-xs font-bold transition-all border-2 \$\{itemColors\.includes\(c\) \? 'border-primary-600 bg-primary-600 text-white shadow-lg shadow-primary-600\/30' : 'border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700'\}\`\}\n\s*>\n\s*\{c\}\n\s*<\/button>/, + match => match.replace('{c}', '{translatedColor}') + ); + // Replace the closing block + code = code.replace( + /<\/button>\n\s*\)\)/, + `\n )})` + ); +} + +fs.writeFileSync('src/App.jsx', code); +console.log('App.jsx updated successfully'); diff --git a/safe_patch.cjs b/safe_patch.cjs new file mode 100644 index 0000000..6183ce9 --- /dev/null +++ b/safe_patch.cjs @@ -0,0 +1,85 @@ +const fs = require('fs'); +let code = fs.readFileSync('src/App.jsx', 'utf8'); + +const replacements = [ + // 1. Remove the laundry message exactly + [`{t('laundryMsg')}
`, ``], + + // 2. Simple exact text string replacements without modifying complex tags or logic + [`> Criar Secção`, `> {t('createSection')}`], + [`Ainda não tem secções criadas`, `{t('noSectionsCreated')}`], + + [`{copiedLookId === look.id ? 'Link copiado!' : 'Partilhar'}`, `{copiedLookId === look.id ? t('linkCopied') : t('share')}`], + + [`peça(s) na lavandaria`, `{t('piecesInLaundry')}`], + [`>A ser lavados<`, `>{t('toBeWashed')}<`], + [`— Indisponíveis (`, `— {t('unavailable')} (`], + [`— Disponíveis (`, `— {t('availableLooks')} (`], + [`Nenhum look disponível`, `{t('noLooksAvailable')}`], + + [``, `{t('sendMessage')}`], + [`'Mensagem enviada com sucesso!'`, `t('msgSentSuccess')`], + [`'Erro ao enviar mensagem. Verifica a tua ligação.'`, `t('msgSendError')`], + + [`Notificações`, `{t('notificationsModal')}`], + [`Sem Notificações`, `{t('noNotifications')}`], + [`>guardou o seu look<`, `>{t('userSavedLook')}<`], + [`no armário dele!`, `{t('inTheirCloset')}`], + + [`Look Partilhado`, `{t('sharedLookTitle')}`], + [`Partilhado por`, `{t('sharedBy')}`], + [`'alguém'`, `t('someone')`], + [`Peças incluídas`, `{t('includedPieces')}`], + [`>Ignorar<`, `>{t('ignore')}<`], + [`A copiar...`, `{t('copying')}`], + [`Copiar para o meu armário`, `{t('copyToMyCloset')}`], + + [`>Adicionar peça como compra futura<`, `>{t('addFuturePurchase')}<`], + [`>{t('wishlist') || 'Lista de Desejos'}<`, `>{t('wishlist') || t('wishlistDesc')}<`], + + [`>Suporte e Feedback<`, `>{t('feedbackTitle')}<`], + [`>Tem alguma ideia, sugestão ou encontrou algum problema? Envie uma mensagem diretamente para nós!<`, `>{t('feedbackDesc')}<`], + [`>Cor do Tema<`, `>{t('themeColorTitle')}<`], + [`>Personalize a cor<`, `>{t('personalizeColorDesc')}<`], + [`Guardar Alterações`, `{t('saveChanges')}`] +]; + +for (const [oldText, newText] of replacements) { + code = code.split(oldText).join(newText); +} + +// Color map safe replacement using very exact match to avoid breaking braces +const oldMapColorCode = `['Vermelho', 'Azul', 'Amarelo', 'Verde', 'Laranja', 'Roxo', 'Branco', 'Preto', 'Cinzento', 'Bege'].map(c => ( + + ); + })}`; +if (code.includes(oldInnerCode)) { + code = code.replace(oldInnerCode, newInnerCode); +} else { + console.log("WARNING: oldInnerCode not found!"); +} + +fs.writeFileSync('src/App.jsx', code); +console.log('Safe patch applied'); diff --git a/src/App.jsx b/src/App.jsx index e762488..a4dfe7f 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1060,7 +1060,7 @@ export default function App() {{t('laundryMsg')}
+Ainda não tem secções criadas
+{t('noSectionsCreated')}
- {look.items.filter(id => { const it = clothes.find(c => c.id === id); return it?.status === 'laundry'; }).length} peça(s) na lavandaria + {look.items.filter(id => { const it = clothes.find(c => c.id === id); return it?.status === 'laundry'; }).length} {t('piecesInLaundry')}
Ainda não tem secções criadas
+{t('noSectionsCreated')}
{notif.type === 'look_copied' && ( - <>O utilizador {notif.copiedByEmail} guardou o seu look "{notif.lookName}" no armário dele!> + <>O utilizador {notif.copiedByEmail} guardou o seu look "{notif.lookName}" {t('inTheirCloset')}> )}
@@ -1864,7 +1864,7 @@ export default function App() {
{sharedLookData.items.length} peça{sharedLookData.items.length !== 1 ? 's' : ''} • Partilhado por {sharedLookData.ownerEmail?.split('@')[0] || 'alguém'}
+{sharedLookData.items.length} peça{sharedLookData.items.length !== 1 ? 's' : ''} • {t('sharedBy')} {sharedLookData.ownerEmail?.split('@')[0] || t('someone')}
Peças incluídas
+{t('includedPieces')}