From 5daf76ace60e9354d570f8fa4b96585ff2b099e0 Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Sat, 26 Apr 2025 16:58:02 +0200 Subject: [PATCH] Translate listOfBans --- public/locales/en/group.json | 6 +++++- src/components/Group/ListOfBans.tsx | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/public/locales/en/group.json b/public/locales/en/group.json index d59e6db..345c6d0 100644 --- a/public/locales/en/group.json +++ b/public/locales/en/group.json @@ -1,5 +1,6 @@ { "action": { + "cancel_ban": "cancel ban", "create_group": "create group", "find_group": "find group", "join_group": "join group", @@ -9,6 +10,7 @@ }, "advanced_options": "advanced options", "approval_threshold": "group Approval Threshold (number / percentage of Admins that must approve a transaction)", + "ban_list": "ban list", "block_delay": { "minimum": "minimum Block delay for Group Transaction Approvals", "maximum": "maximum Block delay for Group Transaction Approvals" @@ -25,6 +27,7 @@ "invitation_expiry": "invitation Expiry Time", "join_requests": "join requests", "question": { + "cancel_ban": "would you like to perform a CANCEL_GROUP_BAN transaction?", "create_group": "would you like to perform an CREATE_GROUP transaction?", "group_invite": "would you like to perform a GROUP_INVITE transaction?", "join_group": "would you like to perform an JOIN_GROUP transaction?", @@ -55,7 +58,8 @@ "join_creation": "successfully requested to join group. It may take a couple of minutes for the changes to propagate", "group_join_name": "joined group {{group_name}}: awaiting confirmation", "group_join_label": "joined group {{name}}: success!", - "loading_threads": "loading threads... please wait." + "loading_threads": "loading threads... please wait.", + "unbanned_user": "successfully unbanned user. It may take a couple of minutes for the changes to propagate" } } } diff --git a/src/components/Group/ListOfBans.tsx b/src/components/Group/ListOfBans.tsx index 850ce13..0c522e0 100644 --- a/src/components/Group/ListOfBans.tsx +++ b/src/components/Group/ListOfBans.tsx @@ -18,6 +18,7 @@ import { getNameInfo } from './Group'; import { getFee } from '../../background'; import { LoadingButton } from '@mui/lab'; import { getBaseApiReact } from '../../App'; +import { useTranslation } from 'react-i18next'; export const getMemberInvites = async (groupNumber) => { const response = await fetch( @@ -55,6 +56,7 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => { const [openPopoverIndex, setOpenPopoverIndex] = useState(null); // Track which list item has the popover open const listRef = useRef(); const [isLoadingUnban, setIsLoadingUnban] = useState(false); + const { t } = useTranslation(['core', 'group']); const getInvites = async (groupId) => { try { @@ -87,7 +89,7 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => { // TODO translate const fee = await getFee('CANCEL_GROUP_BAN'); await show({ - message: 'Would you like to perform a CANCEL_GROUP_BAN transaction?', + message: t('group:question.cancel_ban', { postProcess: 'capitalize' }), publishFee: fee.fee + ' QORT', }); setIsLoadingUnban(true); @@ -103,8 +105,9 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => { setIsLoadingUnban(false); setInfoSnack({ type: 'success', - message: - 'Successfully unbanned user. It may take a couple of minutes for the changes to propagate', + message: t('group:message.success.unbanned_user', { + postProcess: 'capitalize', + }), }); handlePopoverClose(); setOpenSnack(true); @@ -127,6 +130,7 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => { }); }); } catch (error) { + console.log(error); } finally { setIsLoadingUnban(false); } @@ -177,10 +181,13 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => { variant="contained" onClick={() => handleCancelBan(member?.offender)} > - Cancel Ban + {t('group:action.cancel_ban', { + postProcess: 'capitalize', + })} + handlePopoverOpen(event, index)} > @@ -205,7 +212,7 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => { return (
-

Ban list

+

{t('group:ban_list', { postProcess: 'capitalize' })}