remoção de frase e sintonia de idioma
This commit is contained in:
85
safe_patch.cjs
Normal file
85
safe_patch.cjs
Normal file
@@ -0,0 +1,85 @@
|
||||
const fs = require('fs');
|
||||
let code = fs.readFileSync('src/App.jsx', 'utf8');
|
||||
|
||||
const replacements = [
|
||||
// 1. Remove the laundry message exactly
|
||||
[`<p className="opacity-60 font-medium">{t('laundryMsg')}</p>`, ``],
|
||||
|
||||
// 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')}`],
|
||||
|
||||
[`<Input label="Localidade"`, `<Input label={t('location')}`],
|
||||
[`placeholder="Ex: Lisboa, Portugal"`, `placeholder={t('locationEx')}`],
|
||||
|
||||
[`<Input label="Ideia / Sugestão"`, `<Input label={t('ideaSuggestion')}`],
|
||||
[`<Input label="Bug / Erro"`, `<Input label={t('bugError')}`],
|
||||
[`placeholder="Escreva aqui a sua mensagem..."`, `placeholder={t('writeMessage')}`],
|
||||
[`Enviar Mensagem</button>`, `{t('sendMessage')}</button>`],
|
||||
[`'Mensagem enviada com sucesso!'`, `t('msgSentSuccess')`],
|
||||
[`'Erro ao enviar mensagem. Verifica a tua ligação.'`, `t('msgSendError')`],
|
||||
|
||||
[`Notificações</h3>`, `{t('notificationsModal')}</h3>`],
|
||||
[`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 => (
|
||||
<button`;
|
||||
const newMapColorCode = `['Vermelho', 'Azul', 'Amarelo', 'Verde', 'Laranja', 'Roxo', 'Branco', 'Preto', 'Cinzento', 'Bege'].map(c => {
|
||||
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;
|
||||
return (
|
||||
<button`;
|
||||
code = code.replace(oldMapColorCode, newMapColorCode);
|
||||
|
||||
// Safe replacement for {c} inside button
|
||||
const oldInnerCode = ` 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'}\`}
|
||||
>
|
||||
{c}
|
||||
</button>
|
||||
))}`;
|
||||
const newInnerCode = ` 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'}\`}
|
||||
>
|
||||
{translatedColor}
|
||||
</button>
|
||||
);
|
||||
})}`;
|
||||
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');
|
||||
Reference in New Issue
Block a user