Skip to content
Snippets Groups Projects
Unverified Commit b48d256e authored by Robert Dyer's avatar Robert Dyer Committed by GitHub
Browse files

Translation: desktop-client/components/sidebar (#3302)

parent 9c0e6a30
No related branches found
No related tags found
No related merge requests found
// @ts-strict-ignore // @ts-strict-ignore
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import * as queries from 'loot-core/src/client/queries'; import * as queries from 'loot-core/src/client/queries';
...@@ -31,6 +32,7 @@ export function Accounts({ ...@@ -31,6 +32,7 @@ export function Accounts({
onToggleClosedAccounts, onToggleClosedAccounts,
onReorder, onReorder,
}: AccountsProps) { }: AccountsProps) {
const { t } = useTranslation();
const [isDragging, setIsDragging] = useState(false); const [isDragging, setIsDragging] = useState(false);
const failedAccounts = useFailedAccounts(); const failedAccounts = useFailedAccounts();
const updatedAccounts = useUpdatedAccounts(); const updatedAccounts = useUpdatedAccounts();
...@@ -62,7 +64,7 @@ export function Accounts({ ...@@ -62,7 +64,7 @@ export function Accounts({
return ( return (
<View> <View>
<Account <Account
name="All accounts" name={t('All accounts')}
to="/accounts" to="/accounts"
query={queries.allAccountBalance()} query={queries.allAccountBalance()}
style={{ fontWeight, marginTop: 15 }} style={{ fontWeight, marginTop: 15 }}
...@@ -70,7 +72,7 @@ export function Accounts({ ...@@ -70,7 +72,7 @@ export function Accounts({
{budgetedAccounts.length > 0 && ( {budgetedAccounts.length > 0 && (
<Account <Account
name="For budget" name={t('For budget')}
to="/accounts/budgeted" to="/accounts/budgeted"
query={queries.budgetedAccountBalance()} query={queries.budgetedAccountBalance()}
style={{ style={{
...@@ -100,7 +102,7 @@ export function Accounts({ ...@@ -100,7 +102,7 @@ export function Accounts({
{offbudgetAccounts.length > 0 && ( {offbudgetAccounts.length > 0 && (
<Account <Account
name="Off budget" name={t('Off budget')}
to="/accounts/offbudget" to="/accounts/offbudget"
query={queries.offbudgetAccountBalance()} query={queries.offbudgetAccountBalance()}
style={{ style={{
...@@ -131,7 +133,9 @@ export function Accounts({ ...@@ -131,7 +133,9 @@ export function Accounts({
{closedAccounts.length > 0 && ( {closedAccounts.length > 0 && (
<SecondaryItem <SecondaryItem
style={{ marginTop: 15 }} style={{ marginTop: 15 }}
title={'Closed accounts' + (showClosedAccounts ? '' : '...')} title={
showClosedAccounts ? t('Closed accounts') : t('Closed accounts...')
}
onClick={onToggleClosedAccounts} onClick={onToggleClosedAccounts}
bold bold
/> />
...@@ -157,7 +161,7 @@ export function Accounts({ ...@@ -157,7 +161,7 @@ export function Accounts({
}} }}
onClick={onAddAccount} onClick={onAddAccount}
Icon={SvgAdd} Icon={SvgAdd}
title="Add account" title={t('Add account')}
/> />
</View> </View>
); );
......
import React, { useRef, useState } from 'react'; import React, { useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { Resizable } from 're-resizable'; import { Resizable } from 're-resizable';
...@@ -38,6 +39,7 @@ import { Tools } from './Tools'; ...@@ -38,6 +39,7 @@ import { Tools } from './Tools';
export function Sidebar() { export function Sidebar() {
const hasWindowButtons = !Platform.isBrowser && Platform.OS === 'mac'; const hasWindowButtons = !Platform.isBrowser && Platform.OS === 'mac';
const { t } = useTranslation();
const dispatch = useDispatch(); const dispatch = useDispatch();
const sidebar = useSidebar(); const sidebar = useSidebar();
const accounts = useAccounts(); const accounts = useAccounts();
...@@ -149,10 +151,10 @@ export function Sidebar() { ...@@ -149,10 +151,10 @@ export function Sidebar() {
</View> </View>
<View style={{ overflow: 'auto' }}> <View style={{ overflow: 'auto' }}>
<Item title="Budget" Icon={SvgWallet} to="/budget" /> <Item title={t('Budget')} Icon={SvgWallet} to="/budget" />
<Item title="Reports" Icon={SvgReports} to="/reports" /> <Item title={t('Reports')} Icon={SvgReports} to="/reports" />
<Item title="Schedules" Icon={SvgCalendar} to="/schedules" /> <Item title={t('Schedules')} Icon={SvgCalendar} to="/schedules" />
<Tools /> <Tools />
...@@ -177,6 +179,7 @@ export function Sidebar() { ...@@ -177,6 +179,7 @@ export function Sidebar() {
} }
function EditableBudgetName() { function EditableBudgetName() {
const { t } = useTranslation();
const dispatch = useDispatch(); const dispatch = useDispatch();
const navigate = useNavigate(); const navigate = useNavigate();
const [budgetName, setBudgetNamePref] = useMetadataPref('budgetName'); const [budgetName, setBudgetNamePref] = useMetadataPref('budgetName');
...@@ -205,10 +208,10 @@ function EditableBudgetName() { ...@@ -205,10 +208,10 @@ function EditableBudgetName() {
} }
const items = [ const items = [
{ name: 'rename', text: 'Rename budget' }, { name: 'rename', text: t('Rename budget') },
{ name: 'settings', text: 'Settings' }, { name: 'settings', text: t('Settings') },
...(Platform.isBrowser ? [{ name: 'help', text: 'Help' }] : []), ...(Platform.isBrowser ? [{ name: 'help', text: t('Help') }] : []),
{ name: 'close', text: 'Close file' }, { name: 'close', text: t('Close file') },
]; ];
if (editing) { if (editing) {
...@@ -250,7 +253,7 @@ function EditableBudgetName() { ...@@ -250,7 +253,7 @@ function EditableBudgetName() {
onPress={() => setMenuOpen(true)} onPress={() => setMenuOpen(true)}
> >
<Text style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}> <Text style={{ whiteSpace: 'nowrap', overflow: 'hidden' }}>
{budgetName || 'A budget has no name'} {budgetName || t('A budget has no name')}
</Text> </Text>
<SvgExpandArrow width={7} height={7} style={{ marginLeft: 5 }} /> <SvgExpandArrow width={7} height={7} style={{ marginLeft: 5 }} />
</Button> </Button>
......
import React, { type ComponentPropsWithoutRef } from 'react'; import React, { type ComponentPropsWithoutRef } from 'react';
import { useTranslation } from 'react-i18next';
import { SvgPin } from '../../icons/v1'; import { SvgPin } from '../../icons/v1';
import { SvgArrowButtonLeft1 } from '../../icons/v2'; import { SvgArrowButtonLeft1 } from '../../icons/v2';
...@@ -17,11 +18,12 @@ export function ToggleButton({ ...@@ -17,11 +18,12 @@ export function ToggleButton({
isFloating, isFloating,
onFloat, onFloat,
}: ToggleButtonProps) { }: ToggleButtonProps) {
const { t } = useTranslation();
return ( return (
<View className="float" style={{ ...style, flexShrink: 0 }}> <View className="float" style={{ ...style, flexShrink: 0 }}>
<Button <Button
variant="bare" variant="bare"
aria-label={`${isFloating ? 'Pin' : 'Unpin'} sidebar`} aria-label={isFloating ? t('Pin sidebar') : t('Unpin sidebar')}
onPress={onFloat} onPress={onFloat}
style={{ color: theme.buttonMenuBorder }} style={{ color: theme.buttonMenuBorder }}
> >
......
import React, { useState, useCallback, useEffect } from 'react'; import React, { useState, useCallback, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { import {
...@@ -14,6 +15,7 @@ import { Item } from './Item'; ...@@ -14,6 +15,7 @@ import { Item } from './Item';
import { SecondaryItem } from './SecondaryItem'; import { SecondaryItem } from './SecondaryItem';
export function Tools() { export function Tools() {
const { t } = useTranslation();
const [isOpen, setOpen] = useState(false); const [isOpen, setOpen] = useState(false);
const onToggle = useCallback(() => setOpen(open => !open), []); const onToggle = useCallback(() => setOpen(open => !open), []);
const location = useLocation(); const location = useLocation();
...@@ -40,19 +42,19 @@ export function Tools() { ...@@ -40,19 +42,19 @@ export function Tools() {
{isOpen && ( {isOpen && (
<> <>
<SecondaryItem <SecondaryItem
title="Payees" title={t('Payees')}
Icon={SvgStoreFront} Icon={SvgStoreFront}
to="/payees" to="/payees"
indent={15} indent={15}
/> />
<SecondaryItem <SecondaryItem
title="Rules" title={t('Rules')}
Icon={SvgTuning} Icon={SvgTuning}
to="/rules" to="/rules"
indent={15} indent={15}
/> />
<SecondaryItem <SecondaryItem
title="Settings" title={t('Settings')}
Icon={SvgCog} Icon={SvgCog}
to="/settings" to="/settings"
indent={15} indent={15}
......
---
category: Enhancements
authors: [psybers]
---
Support translations in desktop-client/components/sidebar.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment