From b48d256ec4973fd84a119edc3eaf7c30143c4153 Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Thu, 22 Aug 2024 11:23:23 -0500 Subject: [PATCH] Translation: desktop-client/components/sidebar (#3302) --- .../src/components/sidebar/Accounts.tsx | 14 +++++++++----- .../src/components/sidebar/Sidebar.tsx | 19 +++++++++++-------- .../src/components/sidebar/ToggleButton.tsx | 4 +++- .../src/components/sidebar/Tools.tsx | 8 +++++--- upcoming-release-notes/3302.md | 6 ++++++ 5 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 upcoming-release-notes/3302.md diff --git a/packages/desktop-client/src/components/sidebar/Accounts.tsx b/packages/desktop-client/src/components/sidebar/Accounts.tsx index 398a7aae949..93ea82d1f9b 100644 --- a/packages/desktop-client/src/components/sidebar/Accounts.tsx +++ b/packages/desktop-client/src/components/sidebar/Accounts.tsx @@ -1,5 +1,6 @@ // @ts-strict-ignore import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { useSelector } from 'react-redux'; import * as queries from 'loot-core/src/client/queries'; @@ -31,6 +32,7 @@ export function Accounts({ onToggleClosedAccounts, onReorder, }: AccountsProps) { + const { t } = useTranslation(); const [isDragging, setIsDragging] = useState(false); const failedAccounts = useFailedAccounts(); const updatedAccounts = useUpdatedAccounts(); @@ -62,7 +64,7 @@ export function Accounts({ return ( 0 && ( 0 && ( 0 && ( @@ -157,7 +161,7 @@ export function Accounts({ }} onClick={onAddAccount} Icon={SvgAdd} - title="Add account" + title={t('Add account')} /> ); diff --git a/packages/desktop-client/src/components/sidebar/Sidebar.tsx b/packages/desktop-client/src/components/sidebar/Sidebar.tsx index 687410eeeff..7ea8c47f578 100644 --- a/packages/desktop-client/src/components/sidebar/Sidebar.tsx +++ b/packages/desktop-client/src/components/sidebar/Sidebar.tsx @@ -1,4 +1,5 @@ import React, { useRef, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { useDispatch } from 'react-redux'; import { Resizable } from 're-resizable'; @@ -38,6 +39,7 @@ import { Tools } from './Tools'; export function Sidebar() { const hasWindowButtons = !Platform.isBrowser && Platform.OS === 'mac'; + const { t } = useTranslation(); const dispatch = useDispatch(); const sidebar = useSidebar(); const accounts = useAccounts(); @@ -149,10 +151,10 @@ export function Sidebar() { - - + + - + @@ -177,6 +179,7 @@ export function Sidebar() { } function EditableBudgetName() { + const { t } = useTranslation(); const dispatch = useDispatch(); const navigate = useNavigate(); const [budgetName, setBudgetNamePref] = useMetadataPref('budgetName'); @@ -205,10 +208,10 @@ function EditableBudgetName() { } const items = [ - { name: 'rename', text: 'Rename budget' }, - { name: 'settings', text: 'Settings' }, - ...(Platform.isBrowser ? [{ name: 'help', text: 'Help' }] : []), - { name: 'close', text: 'Close file' }, + { name: 'rename', text: t('Rename budget') }, + { name: 'settings', text: t('Settings') }, + ...(Platform.isBrowser ? [{ name: 'help', text: t('Help') }] : []), + { name: 'close', text: t('Close file') }, ]; if (editing) { @@ -250,7 +253,7 @@ function EditableBudgetName() { onPress={() => setMenuOpen(true)} > - {budgetName || 'A budget has no name'} + {budgetName || t('A budget has no name')} diff --git a/packages/desktop-client/src/components/sidebar/ToggleButton.tsx b/packages/desktop-client/src/components/sidebar/ToggleButton.tsx index bf7c79f5dc8..e7fddb15913 100644 --- a/packages/desktop-client/src/components/sidebar/ToggleButton.tsx +++ b/packages/desktop-client/src/components/sidebar/ToggleButton.tsx @@ -1,4 +1,5 @@ import React, { type ComponentPropsWithoutRef } from 'react'; +import { useTranslation } from 'react-i18next'; import { SvgPin } from '../../icons/v1'; import { SvgArrowButtonLeft1 } from '../../icons/v2'; @@ -17,11 +18,12 @@ export function ToggleButton({ isFloating, onFloat, }: ToggleButtonProps) { + const { t } = useTranslation(); return (