Add translations

This commit is contained in:
Nicola Benaglia 2025-05-10 12:17:15 +02:00
parent 35d211c44e
commit 55c042c02b
2 changed files with 17 additions and 8 deletions

View File

@ -42,6 +42,7 @@
"invitees_list": "invitees list", "invitees_list": "invitees list",
"join_link": "join group link", "join_link": "join group link",
"join_requests": "join requests", "join_requests": "join requests",
"latest_mails": "latest Q-Mails",
"message": { "message": {
"generic": { "generic": {
"already_in_group": "you are already in this group!", "already_in_group": "you are already in this group!",

View File

@ -16,6 +16,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import ExpandLessIcon from '@mui/icons-material/ExpandLess'; import ExpandLessIcon from '@mui/icons-material/ExpandLess';
import MarkEmailUnreadIcon from '@mui/icons-material/MarkEmailUnread'; import MarkEmailUnreadIcon from '@mui/icons-material/MarkEmailUnread';
import { useAtom } from 'jotai'; import { useAtom } from 'jotai';
import { useTranslation } from 'react-i18next';
export const isLessThanOneWeekOld = (timestamp) => { export const isLessThanOneWeekOld = (timestamp) => {
// Current time in milliseconds // Current time in milliseconds
@ -53,6 +54,7 @@ export const QMailMessages = ({ userName, userAddress }) => {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(['core', 'group']);
const getMails = useCallback(async () => { const getMails = useCallback(async () => {
try { try {
@ -88,7 +90,10 @@ export const QMailMessages = ({ userName, userAddress }) => {
rej(response.error); rej(response.error);
}) })
.catch((error) => { .catch((error) => {
rej(error.message || 'An error occurred'); rej(
error.message ||
t('core:message.error.generic', { postProcess: 'capitalize' })
);
}); });
}); });
} catch (error) { } catch (error) {
@ -145,13 +150,14 @@ export const QMailMessages = ({ userName, userAddress }) => {
}} }}
onClick={() => setIsExpanded((prev) => !prev)} onClick={() => setIsExpanded((prev) => !prev)}
> >
<Typography // TODO translate <Typography
sx={{ sx={{
fontSize: '1rem', fontSize: '1rem',
}} }}
> >
Latest Q-Mails {t('group:latest_mails', { postProcess: 'capitalize' })}
</Typography> </Typography>
<MarkEmailUnreadIcon <MarkEmailUnreadIcon
sx={{ sx={{
color: anyUnread color: anyUnread
@ -194,9 +200,9 @@ export const QMailMessages = ({ userName, userAddress }) => {
{loading && mails.length === 0 && ( {loading && mails.length === 0 && (
<Box <Box
sx={{ sx={{
width: '100%',
display: 'flex', display: 'flex',
justifyContent: 'center', justifyContent: 'center',
width: '100%',
}} }}
> >
<CustomLoader /> <CustomLoader />
@ -205,11 +211,11 @@ export const QMailMessages = ({ userName, userAddress }) => {
{!loading && mails.length === 0 && ( {!loading && mails.length === 0 && (
<Box <Box
sx={{ sx={{
width: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
display: 'flex',
height: '100%', height: '100%',
justifyContent: 'center',
width: '100%',
}} }}
> >
<Typography <Typography
@ -219,7 +225,9 @@ export const QMailMessages = ({ userName, userAddress }) => {
color: theme.palette.primary, color: theme.palette.primary,
}} }}
> >
Nothing to display {t('group:message.generic.no_display', {
postProcess: 'capitalize',
})}
</Typography> </Typography>
</Box> </Box>
)} )}