Skip to content

Commit

Permalink
Translation: desktop-client/components/payees/ManagePayees (#3623)
Browse files Browse the repository at this point in the history
* Translation: desktop-client/components/payees/ManagePayees

* Move react-i18next import before memoize-one

* Add release notes

* Add prettier formatting

* Fix eslint import/order warning

* Add translation support for "No payees" text
  • Loading branch information
glorenzen authored Oct 14, 2024
1 parent 778fc71 commit b253246
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
29 changes: 15 additions & 14 deletions packages/desktop-client/src/components/payees/ManagePayees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
useCallback,
type ComponentProps,
} from 'react';
import { useTranslation } from 'react-i18next';

import memoizeOne from 'memoize-one';

Expand Down Expand Up @@ -92,6 +93,7 @@ export const ManagePayees = ({
const table = useRef(null);
const triggerRef = useRef(null);
const [orphanedOnly, setOrphanedOnly] = useState(false);
const { t } = useTranslation();

const filteredPayees = useMemo(() => {
let filtered = payees;
Expand Down Expand Up @@ -188,10 +190,10 @@ export const ManagePayees = ({
onPress={() => setMenuOpen(true)}
>
{buttonsDisabled
? 'No payees selected'
? t('No payees selected')
: selected.items.size +
' ' +
plural(selected.items.size, 'payee', 'payees')}
t(plural(selected.items.size, 'payee', 'payees'))}
<SvgExpandArrow width={8} height={8} style={{ marginLeft: 5 }} />
</Button>

Expand Down Expand Up @@ -221,24 +223,23 @@ export const ManagePayees = ({
<Button
variant="bare"
style={{ marginRight: 10 }}
onPress={() => {
setOrphanedOnly(!orphanedOnly);
applyFilter(filter);
}}
onPress={() => setOrphanedOnly(prev => !prev)}
>
{orphanedOnly
? 'Show all payees'
: `Show ${
orphanedPayees.length === 1
? '1 unused payee'
: `${orphanedPayees.length} unused payees`
}`}
? t('Show all payees')
: t(
`Show ${
orphanedPayees.length === 1
? '1 unused payee'
: `${orphanedPayees.length} unused payees`
}`,
)}
</Button>
)}
</View>
<View style={{ flex: 1 }} />
<Search
placeholder="Filter payees..."
placeholder={t('Filter payees...')}
value={filter}
onChange={applyFilter}
/>
Expand All @@ -265,7 +266,7 @@ export const ManagePayees = ({
marginTop: 5,
}}
>
No payees
{t('No payees')}
</View>
) : (
<PayeeTable
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3623.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [glorenzen]
---

Support translations in packages/desktop-client/src/components/payees/ManagePayees.tsx.

0 comments on commit b253246

Please sign in to comment.