Add translations

This commit is contained in:
Nicola Benaglia 2025-05-10 18:49:59 +02:00
parent 99aa214a0f
commit b946e19236
11 changed files with 224 additions and 144 deletions

View File

@ -322,7 +322,7 @@ export const Wallets = ({ setExtState, setRawWallet, rawWallet }) => {
sx={{
display: 'flex',
flexDirection: 'column',
}}
}} // TODO translate
>
<Label>Name</Label>
<Input

View File

@ -446,7 +446,7 @@ export const AppsDevModeHome = ({
display: 'flex',
flexDirection: 'column',
gap: '5px',
}}
}} // TODO translate
>
<Label>Domain</Label>
<Input

View File

@ -152,7 +152,6 @@ export const AppsPrivate = ({ myName }) => {
const object64 = await objectToBase64(objectToSave);
const decryptedData = await window.sendMessage(
'ENCRYPT_QORTAL_GROUP_DATA',
{
base64: object64,
groupId: selectedGroup,
@ -313,7 +312,7 @@ export const AppsPrivate = ({ myName }) => {
display: 'flex',
flexDirection: 'column',
gap: '5px',
}}
}} // TODO translate
>
<Label>Select a group</Label>
<Label>Only private groups will be shown</Label>

View File

@ -371,7 +371,6 @@ export const AddGroup = ({ address, open, setOpen }) => {
}}
>
<Label>
{' '}
{t('group:group.type', {
postProcess: 'capitalize',
})}
@ -428,6 +427,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
postProcess: 'capitalize',
})}
</Label>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"

View File

@ -15,6 +15,7 @@ export const InviteMember = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
const inviteMember = async () => {
try {
const fee = await getFee('GROUP_INVITE');
await show({
message: t('group:question.perform_transaction', {
action: 'GROUP_INVITE',
@ -22,7 +23,9 @@ export const InviteMember = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
}),
publishFee: fee.fee + ' QORT',
});
setIsLoadingInvite(true);
if (!expiryTime || !value) return;
new Promise((res, rej) => {
window
@ -42,7 +45,6 @@ export const InviteMember = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
});
setOpenSnack(true);
res(response);
setValue('');
return;
}
@ -56,7 +58,11 @@ export const InviteMember = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
.catch((error) => {
setInfoSnack({
type: 'error',
message: error?.message || 'An error occurred',
message:
error?.message ||
t('core:message.error.generic', {
postProcess: 'capitalize',
}),
});
setOpenSnack(true);
rej(error);
@ -81,16 +87,21 @@ export const InviteMember = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
}}
>
{t('group:action.invite_member', { postProcess: 'capitalize' })}
<Spacer height="20px" />
<Input
value={value}
placeholder="Name or address"
onChange={(e) => setValue(e.target.value)}
/>
<Spacer height="20px" />
<Label>
{t('group:invitation_expiry', { postProcess: 'capitalize' })}
</Label>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
@ -109,7 +120,9 @@ export const InviteMember = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
<MenuItem value={1296000}>{t('core:time.day', { count: 15 })}</MenuItem>
<MenuItem value={2592000}>{t('core:time.day', { count: 30 })}</MenuItem>
</Select>
<Spacer height="20px" />
<LoadingButton
variant="contained"
loadingPosition="start"

View File

@ -34,7 +34,6 @@ import {
import { Spacer } from '../../common/Spacer';
import { CustomLoader } from '../../common/CustomLoader';
import { RequestQueueWithPromise } from '../../utils/queue/queue';
import {
myGroupsWhereIAmAdminAtom,
promotionTimeIntervalAtom,
@ -89,9 +88,7 @@ export const ListOfGroupPromotions = () => {
const [promotionTimeInterval, setPromotionTimeInterval] = useAtom(
promotionTimeIntervalAtom
);
const [isExpanded, setIsExpanded] = React.useState(false);
const [openSnack, setOpenSnack] = useState(false);
const [infoSnack, setInfoSnack] = useState(null);
const [fee, setFee] = useState(null);
@ -99,7 +96,6 @@ export const ListOfGroupPromotions = () => {
const [isLoadingPublish, setIsLoadingPublish] = useState(false);
const { show } = useContext(MyContext);
const setTxList = useSetAtom(txListAtom);
const theme = useTheme();
const { t } = useTranslation(['core', 'group']);
const listRef = useRef(null);
@ -250,8 +246,9 @@ export const ListOfGroupPromotions = () => {
});
setInfoSnack({
type: 'success',
message:
'Successfully published promotion. It may take a couple of minutes for the promotion to appear',
message: t('group:message.success.group_promotion', {
postProcess: 'capitalize',
}),
});
setOpenSnack(true);
setText('');
@ -261,7 +258,10 @@ export const ListOfGroupPromotions = () => {
setInfoSnack({
type: 'error',
message:
error?.message || 'Error publishing the promotion. Please try again',
error?.message ||
t('group:message.error.group_promotion', {
postProcess: 'capitalize',
}),
});
setOpenSnack(true);
} finally {
@ -290,8 +290,9 @@ export const ListOfGroupPromotions = () => {
if (!response?.error) {
setInfoSnack({
type: 'success',
message:
'Successfully requested to join group. It may take a couple of minutes for the changes to propagate',
message: t('group:message.success.group_join', {
postProcess: 'capitalize',
}),
});
if (isOpen) {
@ -299,8 +300,14 @@ export const ListOfGroupPromotions = () => {
{
...response,
type: 'joined-group',
label: `Joined Group ${group?.groupName}: awaiting confirmation`,
labelDone: `Joined Group ${group?.groupName}: success!`,
label: t('group:message.success.group_join_label', {
group_name: group?.groupName,
postProcess: 'capitalize',
}),
labelDone: t('group:message.success.group_join_label', {
group_name: group?.groupName,
postProcess: 'capitalize',
}),
done: false,
groupId,
},
@ -311,15 +318,20 @@ export const ListOfGroupPromotions = () => {
{
...response,
type: 'joined-group-request',
label: `Requested to join Group ${group?.groupName}: awaiting confirmation`,
labelDone: `Requested to join Group ${group?.groupName}: success!`,
label: t('group:message.success.group_join_request', {
group_name: group?.groupName,
postProcess: 'capitalize',
}),
labelDone: t('group:message.success.group_join_outcome', {
group_name: group?.groupName,
postProcess: 'capitalize',
}),
done: false,
groupId,
},
...prev,
]);
}
setOpenSnack(true);
handlePopoverClose();
res(response);
@ -336,7 +348,9 @@ export const ListOfGroupPromotions = () => {
.catch((error) => {
setInfoSnack({
type: 'error',
message: error.message || 'An error occurred',
message:
error.message ||
t('core:message.error.generic', { postProcess: 'capitalize' }),
});
setOpenSnack(true);
rej(error);
@ -385,7 +399,7 @@ export const ListOfGroupPromotions = () => {
fontSize: '1rem',
}}
>
Group promotions{' '}
{t('group:group.promotions', { postProcess: 'capitalize' })}{' '}
{promotions.length > 0 && ` (${promotions.length})`}
</Typography>
@ -444,7 +458,7 @@ export const ListOfGroupPromotions = () => {
fontSize: '12px',
}}
>
Add Promotion
{t('group.action.add_promotion', { postProcess: 'capitalize' })}
</Button>
</Box>
@ -490,7 +504,9 @@ export const ListOfGroupPromotions = () => {
color: 'rgba(255, 255, 255, 0.2)',
}}
>
Nothing to display
{t('group.message.generic.no_display', {
postProcess: 'capitalize',
})}
</Typography>
</Box>
)}
@ -537,23 +553,25 @@ export const ListOfGroupPromotions = () => {
ref={rowVirtualizer.measureElement} //measure dynamic row height
key={promotion?.identifier}
style={{
position: 'absolute',
top: 0,
left: '50%', // Move to the center horizontally
transform: `translateY(${virtualRow.start}px) translateX(-50%)`, // Adjust for centering
width: '100%', // Control width (90% of the parent)
padding: '10px 0',
display: 'flex',
alignItems: 'center',
overscrollBehavior: 'none',
display: 'flex',
flexDirection: 'column',
gap: '5px',
left: '50%', // Move to the center horizontally
overscrollBehavior: 'none',
padding: '10px 0',
position: 'absolute',
top: 0,
transform: `translateY(${virtualRow.start}px) translateX(-50%)`, // Adjust for centering
width: '100%', // Control width (90% of the parent)
}}
>
<ErrorBoundary
fallback={
<Typography>
Error loading content: Invalid Data
{t('group.message.generic.invalid_data', {
postProcess: 'capitalize',
})}
</Typography>
}
>
@ -568,7 +586,7 @@ export const ListOfGroupPromotions = () => {
<Popover
open={openPopoverIndex === promotion?.groupId}
anchorEl={popoverAnchor}
onClose={(event, reason) => {
onClose={(reason) => {
if (reason === 'backdropClick') {
// Prevent closing on backdrop click
return;
@ -603,7 +621,10 @@ export const ListOfGroupPromotions = () => {
fontWeight: 600,
}}
>
Group name: {` ${promotion?.groupName}`}
{t('group:group.name', {
postProcess: 'capitalize',
})}
: {` ${promotion?.groupName}`}
</Typography>
<Typography
@ -612,8 +633,10 @@ export const ListOfGroupPromotions = () => {
fontWeight: 600,
}}
>
Number of members:{' '}
{` ${promotion?.memberCount}`}
{t('group:group.member_number', {
postProcess: 'capitalize',
})}
: {` ${promotion?.memberCount}`}
</Typography>
{promotion?.description && (
@ -634,9 +657,9 @@ export const ListOfGroupPromotions = () => {
fontWeight: 600,
}}
>
*This is a closed/private group, so you
will need to wait until an admin accepts
your request
{t('group:message.generic.closed_group', {
postProcess: 'capitalize',
})}
</Typography>
)}
@ -657,7 +680,9 @@ export const ListOfGroupPromotions = () => {
variant="contained"
onClick={handlePopoverClose}
>
Close
{t('core:action.close', {
postProcess: 'capitalize',
})}
</LoadingButton>
<LoadingButton
@ -671,7 +696,9 @@ export const ListOfGroupPromotions = () => {
)
}
>
Join
{t('core:action.join', {
postProcess: 'capitalize',
})}
</LoadingButton>
</Box>
</Box>
@ -755,8 +782,12 @@ export const ListOfGroupPromotions = () => {
}}
>
{promotion?.isOpen
? 'Public group'
: 'Private group'}
? t('group:group.public', {
postProcess: 'capitalize',
})
: t('group:group.private', {
postProcess: 'capitalize',
})}
</Typography>
</Box>
@ -790,7 +821,10 @@ export const ListOfGroupPromotions = () => {
color: theme.palette.text.primary,
}}
>
Join Group: {` ${promotion?.groupName}`}
{t('group:action.join_group', {
postProcess: 'capitalize',
})}
: {` ${promotion?.groupName}`}
</Button>
</Box>
</Box>
@ -810,24 +844,31 @@ export const ListOfGroupPromotions = () => {
<Spacer height="20px" />
{isShowModal && (
<Dialog
open={isShowModal}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle id="alert-dialog-title">
{'Promote your group to non-members'}
{t('group:action.promote_group', { postProcess: 'capitalize' })}
</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
Only the latest promotion from the week will be shown for your
group.
{t('group:message.generic.latest_promotion', {
postProcess: 'capitalize',
})}
</DialogContentText>
<DialogContentText id="alert-dialog-description2">
Max 200 characters. Publish Fee: {fee && fee} {' QORT'}
{t('group:message.generic.max_chars', {
postProcess: 'capitalize',
})}
: {fee && fee} {' QORT'}
</DialogContentText>
<Spacer height="20px" />
<Box
sx={{
display: 'flex',
@ -835,8 +876,18 @@ export const ListOfGroupPromotions = () => {
gap: '5px',
}}
>
<Label>Select a group</Label>
<Label>Only groups where you are an admin will be shown</Label>
<Label>
{t('group:action.select_group', {
postProcess: 'capitalize',
})}
</Label>
<Label>
{t('group:message.generic.admin_only', {
postProcess: 'capitalize',
})}
</Label>
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
@ -854,7 +905,9 @@ export const ListOfGroupPromotions = () => {
})}
</Select>
</Box>
<Spacer height="20px" />
<TextField
label="Promotion text"
variant="filled"
@ -875,13 +928,16 @@ export const ListOfGroupPromotions = () => {
}}
/>
</DialogContent>
<DialogActions>
<Button
disabled={isLoadingPublish}
variant="contained"
onClick={() => setIsShowModal(false)}
>
Close
{t('core:action.close', {
postProcess: 'capitalize',
})}
</Button>
<Button
disabled={!text.trim() || !selectedGroup || isLoadingPublish}
@ -889,11 +945,13 @@ export const ListOfGroupPromotions = () => {
onClick={publishPromo}
autoFocus
>
Publish
{t('core:action.publish', {
postProcess: 'capitalize',
})}
</Button>
</DialogActions>
</Dialog>
)}
<CustomizedSnackbars
open={openSnack}
setOpen={setOpenSnack}

View File

@ -1,21 +1,17 @@
import * as React from 'react';
import Button from '@mui/material/Button';
import Snackbar, { SnackbarCloseReason } from '@mui/material/Snackbar';
import Snackbar from '@mui/material/Snackbar';
import Alert from '@mui/material/Alert';
export const LoadingSnackbar = ({open, info}) => {
export const LoadingSnackbar = ({ open, info }) => {
return (
<div>
<Snackbar anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} open={open}>
<Alert
severity="info"
variant="filled"
sx={{ width: '100%' }}
<Snackbar
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
open={open}
>
<Alert severity="info" variant="filled" sx={{ width: '100%' }}>
{info?.message}
</Alert>
</Snackbar>
</div>
);
}
};

View File

@ -1,4 +1,3 @@
import * as React from 'react';
import Snackbar, { SnackbarCloseReason } from '@mui/material/Snackbar';
import Alert from '@mui/material/Alert';

View File

@ -198,9 +198,11 @@ export const TaskManager = ({ getUserInfo }) => {
/>
)}
</ListItemIcon>
<ListItemText primary="Ongoing Transactions" />
{open ? <ExpandLess /> : <ExpandMore />}
</ListItemButton>
<Collapse in={open} timeout="auto" unmountOnExit>
<List component="div" disablePadding>
{txList.map((item) => (

View File

@ -27,7 +27,8 @@
},
"notify": "notify",
"post": "post",
"post_message": "post message"
"post_message": "post message",
"publish": "publish"
},
"admin": "admin",
"core": {

View File

@ -1,5 +1,6 @@
{
"action": {
"add_promotion": "add promotion",
"ban": "ban member from group",
"cancel_ban": "cancel ban",
"copy_private_key": "copy private key",
@ -16,9 +17,11 @@
"load_members": "load members with names",
"make_admin": "make an admin",
"manage_members": "manage members",
"promote_group": "promote your group to non-members",
"refetch_page": "refetch page",
"remove_admin": "remove as admin",
"return_to_thread": "return to threads"
"return_to_thread": "return to threads",
"select_group": "select a group"
},
"advanced_options": "advanced options",
"approval_threshold": "group Approval Threshold (number / percentage of Admins that must approve a transaction)",
@ -36,6 +39,9 @@
"member_number": "number of members",
"name": "group name",
"open": "open (public)",
"private": "private group",
"promotions": "group promotions",
"public": "public group",
"type": "group type"
},
"invitation_expiry": "invitation Expiry Time",
@ -46,12 +52,16 @@
"latest_mails": "latest Q-Mails",
"message": {
"generic": {
"admin_only": "only groups where you are an admin will be shown",
"already_in_group": "you are already in this group!",
"closed_group": "this is a closed/private group, so you will need to wait until an admin accepts your request",
"descrypt_wallet": "decrypting wallet...",
"encryption_key": "the group's first common encryption key is in the process of creation. Please wait a few minutes for it to be retrieved by the network. Checking every 2 minutes...",
"group_invited_you": "{{group}} has invited you",
"invalid_data": "error loading content: Invalid Data",
"latest_promotion": "only the latest promotion from the week will be shown for your group.",
"loading_members": "loading member list with names... please wait.",
"max_chars": " Max 200 characters. Publish Fee",
"no_display": "nothing to display",
"no_selection": "no group selected",
"not_part_group": "you are not part of the encrypted group of members. Wait until an admin re-encrypts the keys.",
@ -66,6 +76,7 @@
"descrypt_wallet": "error decrypting wallet {{ :errorMessage }}",
"description_required": "please provide a description",
"group_info": "cannot access group information",
"group_promotion": "error publishing the promotion. Please try again",
"group_secret_key": "cannot get group secret key",
"name_required": "please provide a name",
"notify_admins": "try notifying an admin from the list of admins below:",
@ -87,6 +98,7 @@
"group_leave_name": "left group {{group_name}}: awaiting confirmation",
"group_leave_label": "left group {{name}}: success!",
"group_member_admin": "successfully made member an admin. It may take a couple of minutes for the changes to propagate",
"group_promotion": "successfully published promotion. It may take a couple of minutes for the promotion to appear",
"group_remove_member": "successfully removed member as an admin. It may take a couple of minutes for the changes to propagate",
"invitation_cancellation": "successfully canceled invitation. It may take a couple of minutes for the changes to propagate",
"invitation_request": "accepted join request: awaiting confirmation",