From e436c0143071dbd4845c0038ce9dbfdce906b11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Eduardo=20C=C3=A1nepa=20Cihuelo?= <10290593+manuelcanepa@users.noreply.github.com> Date: Tue, 30 Aug 2022 19:22:43 -0300 Subject: [PATCH] #199 Adding translation to schedules list (#219) * #199 Adding translation to schedules list * #199 Complete translation on EditSchedule Form * #199 Translation for status badge * #199 Minor changes, suggested by @j-f1 Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> --- .../src/components/schedules/EditSchedule.js | 69 +++++++++++-------- .../components/schedules/SchedulesTable.js | 39 +++++++---- .../src/components/schedules/StatusBadge.js | 19 +++-- .../src/components/schedules/index.js | 7 +- .../desktop-client/src/locales/en-GB.json | 56 ++++++++++++++- .../desktop-client/src/locales/es-ES.json | 54 +++++++++++++++ 6 files changed, 195 insertions(+), 49 deletions(-) diff --git a/packages/desktop-client/src/components/schedules/EditSchedule.js b/packages/desktop-client/src/components/schedules/EditSchedule.js index 0e25e3b..60c8277 100644 --- a/packages/desktop-client/src/components/schedules/EditSchedule.js +++ b/packages/desktop-client/src/components/schedules/EditSchedule.js @@ -27,6 +27,7 @@ import { usePageType } from '../Page'; import { Page } from '../Page'; import { OpSelect } from '../modals/EditRule'; import { AmountInput, BetweenAmountInput } from '../util/AmountInput'; +import { useTranslation } from 'react-i18next'; function mergeFields(defaults, initial) { let res = { ...defaults }; @@ -92,6 +93,7 @@ export default function ScheduleDetails() { }); let pageType = usePageType(); + const { t } = useTranslation(); let [state, dispatch] = useReducer( (state, action) => { @@ -365,8 +367,10 @@ export default function ScheduleDetails() { if (res.error) { dispatch({ type: 'form-error', - error: - 'An error occurred while saving. Please contact help@actualbudget.com for support.' + // Note: email is outside of translation to be easily replace on future + error: t('support.anErrorOccuredWhileSaving', { + email: 'help@actualbudget.com' + }) }); } else { if (adding) { @@ -423,15 +427,19 @@ export default function ScheduleDetails() { return ( - + dispatch({ type: 'set-field', field: 'payee', value: id }) } @@ -439,10 +447,10 @@ export default function ScheduleDetails() { - + dispatch({ type: 'set-field', field: 'account', value: id }) } @@ -451,18 +459,21 @@ export default function ScheduleDetails() { - + { switch (op) { case 'is': - return 'is exactly'; + return t('schedules.isExactly'); case 'isapprox': - return 'is approximately'; + return t('schedules.isApproximately'); case 'isbetween': - return 'is between'; + return t('schedules.isBetween'); default: throw new Error('Invalid op for select: ' + op); } @@ -504,7 +515,7 @@ export default function ScheduleDetails() { - + @@ -529,7 +540,7 @@ export default function ScheduleDetails() { {state.upcomingDates && ( - Upcoming dates + {t('schedules.upcomingDates')} @@ -592,7 +603,7 @@ export default function ScheduleDetails() { }} /> @@ -606,8 +617,7 @@ export default function ScheduleDetails() { lineHeight: '1.4em' }} > - If checked, the schedule will automatically create transactions for - you in the specified account + {t('schedules.automaticallyAddTransactionAdvice')} {!adding && state.schedule.rule && ( @@ -621,11 +631,11 @@ export default function ScheduleDetails() { width: 350 }} > - This schedule has custom conditions and actions + {t('schedules.thisScheduleHasCustomConditionsAndActions')} )} )} @@ -637,11 +647,11 @@ export default function ScheduleDetails() { {adding ? ( - These transactions match this schedule: + {t('schedules.theseTransactionsMatchThisSchedule')} - Select transactions to link on save + {t('schedules.selectTransactionsToLinkOnSave')} ) : ( @@ -656,7 +666,7 @@ export default function ScheduleDetails() { }} onClick={() => onSwitchTransactions('linked')} > - Linked transactions + {t('schedules.linkedTransactions')} {' '} { switch (name) { @@ -715,10 +730,10 @@ export default function ScheduleDetails() { > {state.error && {state.error}} diff --git a/packages/desktop-client/src/components/schedules/SchedulesTable.js b/packages/desktop-client/src/components/schedules/SchedulesTable.js index fa2a339..77d6cd3 100644 --- a/packages/desktop-client/src/components/schedules/SchedulesTable.js +++ b/packages/desktop-client/src/components/schedules/SchedulesTable.js @@ -22,12 +22,15 @@ import DotsHorizontalTriple from 'loot-design/src/svg/v1/DotsHorizontalTriple'; import Check from 'loot-design/src/svg/v2/Check'; import DisplayId from '../util/DisplayId'; import { StatusBadge } from './StatusBadge'; +import { useTranslation } from 'react-i18next'; export let ROW_HEIGHT = 43; function OverflowMenu({ schedule, status, onAction }) { let [open, setOpen] = useState(false); + const { t } = useTranslation(); + return ( diff --git a/packages/desktop-client/src/locales/en-GB.json b/packages/desktop-client/src/locales/en-GB.json index fc1b4e5..51ae70d 100644 --- a/packages/desktop-client/src/locales/en-GB.json +++ b/packages/desktop-client/src/locales/en-GB.json @@ -8,8 +8,62 @@ "needAccountMessage": "For Actual to be useful, you need to add an account. You can link an account to automatically download transactions, or manage it locally yourself." }, "bootstrap": { - "title": "Bootstrap this Actual instance", "setPassword": "Set a password for this server instance", + "title": "Bootstrap this Actual instance", "tryDemo": "Try Demo" + }, + "general": { + "account": "Account", + "add": "Add", + "amount": "Amount", + "approximatelyWithAmount": "Approximately {{amount}}", + "cancel": "Cancel", + "complete": "Complete", + "date": "Date", + "delete": "Delete", + "payee": "Payee", + "recurring": "Recurring", + "repeats": "Repeats", + "restart": "Restart", + "save": "Save", + "schedule": "Schedule", + "schedules": "Schedules", + "status": "Status" + }, + "schedules": { + "addNewSchedule": "Add new schedule", + "automaticallyAddTransaction": "Automatically add transaction", + "automaticallyAddTransactionAdvice": "If checked, the schedule will automatically create transactions for you in the specified account", + "editAsRule": "Edit as rule", + "findMatchingTransactions": "Find matching transactions", + "isApproximately": "is approximately", + "isBetween": "is between", + "isExactly": "is exactly", + "linkedTransactions": "Linked transactions", + "linkToSchedule": "Link to schedule", + "nextDate": "Next date", + "none": "(none)", + "noSchedules": "No schedules", + "postTransaction": "Post transaction", + "scheduleNamed": "Schedule: {{name}}", + "selectTransactionsToLinkOnSave": "Select transactions to link on save", + "showCompletedSchedules": "Show completed schedules", + "skipNextDate": "Skip next date", + "theseTransactionsMatchThisSchedule": "These transactions match this schedule:", + "thisScheduleHasCustomConditionsAndActions": "This schedule has custom conditions and actions", + "unlinkFromSchedule": "Unlink from schedule", + "upcomingDates": "Upcoming dates" + }, + "status": { + "completed": "completed", + "due": "due", + "missed": "missed", + "paid": "paid", + "pending": "pending", + "scheduled": "scheduled", + "upcoming": "upcoming" + }, + "support": { + "anErrorOccuredWhileSaving": "An error occurred while saving. Please contact {{email}} for support." } } diff --git a/packages/desktop-client/src/locales/es-ES.json b/packages/desktop-client/src/locales/es-ES.json index 64d1208..57b6dea 100644 --- a/packages/desktop-client/src/locales/es-ES.json +++ b/packages/desktop-client/src/locales/es-ES.json @@ -11,5 +11,59 @@ "setPassword": "Establecer una contraseña para esta instancia de servidor", "title": "Bootstrap esta instancia de Actual", "tryDemo": "Probar Demo" + }, + "general": { + "account": "Cuenta", + "add": "Agregar", + "amount": "Monto", + "approximatelyWithAmount": "Aproximadamente {{amount}}", + "cancel": "Cancelar", + "complete": "Completar", + "date": "Fecha", + "delete": "Borrar", + "payee": "Beneficiario", + "recurring": "Periódico", + "repeats": "Repetir", + "restart": "Reiniciar", + "save": "Guardar", + "schedule": "Agenda", + "schedules": "Agendas", + "status": "Estado" + }, + "schedules": { + "addNewSchedule": "Agregar nuevo agenda", + "automaticallyAddTransaction": "Agregar transacción automáticamente", + "automaticallyAddTransactionAdvice": "Si se selecciona, la agenda creará automáticamente una transacción para la cuenta especificada", + "editAsRule": "Editar como regla", + "findMatchingTransactions": "Encontrar transacciones que coincidan", + "isApproximately": "es aproximadamente", + "isBetween": "está entre", + "isExactly": "es exactamente", + "linkedTransactions": "Transacciones vinculadas", + "linkToSchedule": "Vincular a agenda", + "nextDate": "Próxima fecha", + "none": "(ninguno)", + "noSchedules": "Sin agendas", + "postTransaction": "Publicar transacción", + "scheduleNamed": "Agenda: {{name}}", + "selectTransactionsToLinkOnSave": "Seleccionar transacciones para vincular al guardar", + "showCompletedSchedules": "Mostrar agendas completadas", + "skipNextDate": "Saltar próxima fecha", + "theseTransactionsMatchThisSchedule": "Éstas transacciones coinciden con la agenda", + "thisScheduleHasCustomConditionsAndActions": "Ésta agenda tiene condiciones y acciones personalizadas", + "unlinkFromSchedule": "Desvincular de la agenda", + "upcomingDates": "Próximas fechas" + }, + "status": { + "completed": "completo", + "due": "adeudado", + "missed": "omitido", + "paid": "pago", + "pending": "pendiente", + "scheduled": "agendado", + "upcoming": "próximo" + }, + "support": { + "anErrorOccuredWhileSaving": "Ocurrió un error al guardar. Por favor, póngase en contacto con {{email}} para obtener asistencia." } }