Open-source personal finance manager. Self-hosted, privacy-first.
fix: replace hardcoded Portuguese strings with i18n keys
Tássio Noronha6edc05f65e29
diff --git a/frontend/src/components/icon-picker.tsx b/frontend/src/components/icon-picker.tsxindex 25d57bb0..14bf8beb 100644--- a/frontend/src/components/icon-picker.tsx+++ b/frontend/src/components/icon-picker.tsx@@ -1,4 +1,5 @@import { useState, useMemo } from 'react'+import { useTranslation } from 'react-i18next'import { CATEGORY_ICONS } from '@/lib/category-icons'import { cn } from '@/lib/utils'@@ -9,6 +10,7 @@ interface IconPickerProps {}export function IconPicker({ value, color, onChange }: IconPickerProps) {+ const { t } = useTranslation()const [search, setSearch] = useState('')const filtered = useMemo(() => {@@ -25,7 +27,7 @@ export function IconPicker({ value, color, onChange }: IconPickerProps) {<div className="space-y-2"><inputtype="text"- placeholder="Buscar ícone..."+ placeholder={t('common.searchIcon')}className="w-full border border-border rounded-lg px-3 py-1.5 text-sm bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-primary"value={search}onChange={(e) => setSearch(e.target.value)}@@ -58,7 +60,7 @@ export function IconPicker({ value, color, onChange }: IconPickerProps) {})}{filtered.length === 0 && (<p className="col-span-8 text-xs text-muted-foreground text-center py-4">- Nenhum ícone encontrado+ {t('common.noIconsFound')}</p>)}</div>diff --git a/frontend/src/components/transaction-dialog.tsx b/frontend/src/components/transaction-dialog.tsxindex 1ba00de8..7372f9e7 100644--- a/frontend/src/components/transaction-dialog.tsx+++ b/frontend/src/components/transaction-dialog.tsx@@ -30,12 +30,12 @@ export function extractApiError(error: unknown): string {if (Array.isArray(detail)) {return detail.map((d: { msg?: string; loc?: string[] }) => {const field = d.loc?.slice(-1)[0] ?? ''- return `${field}: ${d.msg ?? 'inválido'}`+ return `${field}: ${d.msg ?? 'invalid'}`}).join(', ')}}}- return 'Ocorreu um erro inesperado'+ return 'An unexpected error occurred'}export function TransactionDialog({@@ -200,7 +200,7 @@ function TransactionForm({/></div><div className="space-y-2">- <Label>Moeda</Label>+ <Label>{t('transactions.currency')}</Label><selectclassName="w-full border border-border rounded-md px-3 py-2 text-sm bg-background h-9 disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"value={currency}@@ -222,15 +222,15 @@ function TransactionForm({</div><div className="grid grid-cols-2 gap-4"><div className="space-y-2">- <Label>Tipo</Label>+ <Label>{t('transactions.type')}</Label><selectclassName="w-full border border-border rounded-md px-3 py-2 text-sm bg-background disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-ring/30 focus-visible:ring-[2px]"value={type}onChange={(e) => setType(e.target.value as 'debit' | 'credit')}disabled={isSynced}>- <option value="debit">Despesa</option>- <option value="credit">Receita</option>+ <option value="debit">{t('transactions.expense')}</option>+ <option value="credit">{t('transactions.income')}</option></select></div><div className="space-y-2">@@ -264,13 +264,13 @@ function TransactionForm({)}<div className="space-y-2">- <Label>Notas <span className="text-muted-foreground font-normal text-xs">(opcional — use #tags para categorizar)</span></Label>+ <Label>{t('transactions.notes')} <span className="text-muted-foreground font-normal text-xs">({t('transactions.notesHint')})</span></Label><textareaclassName="w-full border border-input rounded-md px-3 py-2 text-sm bg-background resize-none focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-0"rows={2}value={notes}onChange={(e) => setNotes(e.target.value)}- placeholder="Ex: jantar de negócios #work #reimbursable"+ placeholder={t('transactions.notesPlaceholder')}/></div>diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.jsonindex 2de05d43..f1ce05ba 100644--- a/frontend/src/locales/en.json+++ b/frontend/src/locales/en.json@@ -32,7 +32,10 @@"currentPassword": "Current password","currentPasswordWrong": "Current password is incorrect","passwordChanged": "Password changed successfully",- "passwordChangeError": "Failed to change password"+ "passwordChangeError": "Failed to change password",+ "confirmPassword": "Confirm password",+ "passwordMismatch": "Passwords do not match",+ "registrationError": "Error creating account. Please try again."},"dashboard": {"title": "Dashboard",@@ -111,7 +114,14 @@"selectCategory": "Select category...","noResults": "No transactions found","previous": "Previous",- "next": "Next"+ "next": "Next",+ "currency": "Currency",+ "type": "Type",+ "expense": "Expense",+ "income": "Income",+ "notes": "Notes",+ "notesHint": "optional — use #tags to categorize",+ "notesPlaceholder": "E.g.: business dinner #work #reimbursable"},"accounts": {"title": "Accounts",@@ -463,7 +473,9 @@"edit": "Edit","loading": "Loading...","error": "Error",- "success": "Success"+ "success": "Success",+ "searchIcon": "Search icon...",+ "noIconsFound": "No icons found"},"privacy": {"hide": "Hide values",diff --git a/frontend/src/locales/pt-BR.json b/frontend/src/locales/pt-BR.jsonindex 8769f345..8ea31df6 100644--- a/frontend/src/locales/pt-BR.json+++ b/frontend/src/locales/pt-BR.json@@ -32,7 +32,10 @@"currentPassword": "Senha atual","currentPasswordWrong": "Senha atual incorreta","passwordChanged": "Senha alterada com sucesso",- "passwordChangeError": "Erro ao alterar a senha"+ "passwordChangeError": "Erro ao alterar a senha",+ "confirmPassword": "Confirmar senha",+ "passwordMismatch": "As senhas não conferem",+ "registrationError": "Erro ao criar conta. Tente novamente."},"dashboard": {"title": "Painel",@@ -111,7 +114,14 @@"selectCategory": "Selecionar categoria...","noResults": "Nenhuma transação encontrada","previous": "Anterior",- "next": "Próxima"+ "next": "Próxima",+ "currency": "Moeda",+ "type": "Tipo",+ "expense": "Despesa",+ "income": "Receita",+ "notes": "Notas",+ "notesHint": "opcional — use #tags para categorizar",+ "notesPlaceholder": "Ex: jantar de negócios #work #reimbursable"},"accounts": {"title": "Contas",@@ -463,7 +473,9 @@"edit": "Editar","loading": "Carregando...","error": "Erro",- "success": "Sucesso"+ "success": "Sucesso",+ "searchIcon": "Buscar ícone...",+ "noIconsFound": "Nenhum ícone encontrado"},"privacy": {"hide": "Ocultar valores",diff --git a/frontend/src/pages/register.tsx b/frontend/src/pages/register.tsxindex 0133c832..a24f2edc 100644--- a/frontend/src/pages/register.tsx+++ b/frontend/src/pages/register.tsx@@ -23,12 +23,12 @@ export default function RegisterPage() {setError('')if (password !== confirmPassword) {- setError('As senhas não conferem')+ setError(t('auth.passwordMismatch'))return}if (password.length < 8) {- setError('A senha deve ter pelo menos 8 caracteres')+ setError(t('auth.passwordTooShort'))return}@@ -37,7 +37,7 @@ export default function RegisterPage() {await register(email, password)navigate('/')} catch {- setError('Erro ao criar conta. Tente novamente.')+ setError(t('auth.registrationError'))} finally {setIsLoading(false)}@@ -85,7 +85,7 @@ export default function RegisterPage() {/></div><div className="space-y-2">- <Label htmlFor="confirmPassword">Confirmar senha</Label>+ <Label htmlFor="confirmPassword">{t('auth.confirmPassword')}</Label><Inputid="confirmPassword"type="password"