Add translations

This commit is contained in:
Nicola Benaglia 2025-05-18 20:06:09 +02:00
parent e8db9887be
commit 33b9820db3
5 changed files with 57 additions and 18 deletions

View File

@ -454,7 +454,9 @@ export const ChatOptions = ({
> >
<Select <Select
id="demo-simple-select" id="demo-simple-select"
label="By member" label={t('core:sort.by_member', {
postProcess: 'capitalizeFirst',
})}
labelId="demo-simple-select-label" labelId="demo-simple-select-label"
onChange={(e) => setSelectedMember(e.target.value)} onChange={(e) => setSelectedMember(e.target.value)}
size="small" size="small"

View File

@ -8,6 +8,7 @@ import { MembersIcon } from '../../assets/Icons/MembersIcon';
import { AdminsIcon } from '../../assets/Icons/AdminsIcon'; import { AdminsIcon } from '../../assets/Icons/AdminsIcon';
import LockIcon from '@mui/icons-material/Lock'; import LockIcon from '@mui/icons-material/Lock';
import NoEncryptionGmailerrorredIcon from '@mui/icons-material/NoEncryptionGmailerrorred'; import NoEncryptionGmailerrorredIcon from '@mui/icons-material/NoEncryptionGmailerrorred';
import { useTranslation } from 'react-i18next';
const IconWrapper = ({ const IconWrapper = ({
children, children,
@ -83,6 +84,8 @@ export const DesktopHeader = ({
}) => { }) => {
const [value, setValue] = useState(0); const [value, setValue] = useState(0);
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(['auth', 'core', 'group']);
return ( return (
<Box <Box
sx={{ sx={{
@ -108,6 +111,7 @@ export const DesktopHeader = ({
}} }}
/> />
)} )}
{isPrivate === false && ( {isPrivate === false && (
<NoEncryptionGmailerrorredIcon <NoEncryptionGmailerrorredIcon
sx={{ sx={{
@ -115,6 +119,7 @@ export const DesktopHeader = ({
}} }}
/> />
)} )}
<Typography <Typography
sx={{ sx={{
fontSize: '16px', fontSize: '16px',
@ -122,7 +127,7 @@ export const DesktopHeader = ({
}} }}
> >
{selectedGroup?.groupId === '0' {selectedGroup?.groupId === '0'
? 'General' ? t('core:general', { postProcess: 'capitalizeFirst' })
: selectedGroup?.groupName} : selectedGroup?.groupName}
</Typography> </Typography>
</Box> </Box>
@ -146,7 +151,7 @@ export const DesktopHeader = ({
? theme.palette.text.primary ? theme.palette.text.primary
: theme.palette.text.secondary : theme.palette.text.secondary
} }
label="ANN" label={t('core:announcement', { postProcess: 'capitalizeFirst' })}
selected={isAnnouncement} selected={isAnnouncement}
selectColor={theme.palette.action.selected} selectColor={theme.palette.action.selected}
customHeight="55px" customHeight="55px"
@ -174,7 +179,7 @@ export const DesktopHeader = ({
color={ color={
isChat ? theme.palette.text.primary : theme.palette.text.secondary isChat ? theme.palette.text.primary : theme.palette.text.secondary
} }
label="Chat" label={t('core:chat', { postProcess: 'capitalizeFirst' })}
selected={isChat} selected={isChat}
selectColor={theme.palette.action.selected} selectColor={theme.palette.action.selected}
customHeight="55px" customHeight="55px"
@ -204,7 +209,7 @@ export const DesktopHeader = ({
? theme.palette.text.primary ? theme.palette.text.primary
: theme.palette.text.secondary : theme.palette.text.secondary
} }
label="Threads" label={t('core:thread_other', { postProcess: 'capitalizeFirst' })}
selected={isForum} selected={isForum}
selectColor={theme.palette.action.selected} selectColor={theme.palette.action.selected}
customHeight="55px" customHeight="55px"
@ -229,7 +234,7 @@ export const DesktopHeader = ({
<IconWrapper <IconWrapper
color={theme.palette.text.secondary} color={theme.palette.text.secondary}
customHeight="55px" customHeight="55px"
label="Members" label={t('core:member_other', { postProcess: 'capitalizeFirst' })}
selected={false} selected={false}
> >
<MembersIcon <MembersIcon
@ -251,7 +256,7 @@ export const DesktopHeader = ({
? theme.palette.text.primary ? theme.palette.text.primary
: theme.palette.text.secondary : theme.palette.text.secondary
} }
label="Admins" label={t('core:admin_other', { postProcess: 'capitalizeFirst' })}
selected={groupSection === 'adminSpace'} selected={groupSection === 'adminSpace'}
customHeight="55px" customHeight="55px"
selectColor={theme.palette.action.selected} selectColor={theme.palette.action.selected}

View File

@ -107,7 +107,7 @@ export const Embed = ({ embedLink }) => {
setType('POLL'); setType('POLL');
if (!parsedData?.name) if (!parsedData?.name)
throw new Error( throw new Error(
t('core:message.error.invalid_embed_link_name', { t('core:message.error.invalid_poll_embed_link_name', {
postProcess: 'capitalizeFirst', postProcess: 'capitalizeFirst',
}) })
); );
@ -237,9 +237,10 @@ export const Embed = ({ embedLink }) => {
if (imageFinalUrl) { if (imageFinalUrl) {
return imageFinalUrl; return imageFinalUrl;
} else { } else {
//TODO translate
setErrorMsg( setErrorMsg(
'Unable to download IMAGE. Please try again later by clicking the refresh button' t('core:message.error.unable_download_image', {
postProcess: 'capitalizeFirst',
})
); );
return null; return null;
} }
@ -248,7 +249,7 @@ export const Embed = ({ embedLink }) => {
setErrorMsg( setErrorMsg(
error?.error || error?.error ||
error?.message || error?.message ||
'An unexpected error occurred while trying to download the image' t('core:message.error.generic', { postProcess: 'capitalizeFirst' })
); );
return null; return null;
} }
@ -259,7 +260,11 @@ export const Embed = ({ embedLink }) => {
setIsLoading(true); setIsLoading(true);
setErrorMsg(''); setErrorMsg('');
if (!parsedData?.name || !parsedData?.service || !parsedData?.identifier) if (!parsedData?.name || !parsedData?.service || !parsedData?.identifier)
throw new Error('Invalid image embed link. Missing param.'); throw new Error(
t('core:message.error.invalid_image_embed_link_name', {
postProcess: 'capitalizeFirst',
})
);
let image = await getImage( let image = await getImage(
{ {
name: parsedData.name, name: parsedData.name,
@ -272,7 +277,12 @@ export const Embed = ({ embedLink }) => {
setImageUrl(image); setImageUrl(image);
} catch (error) { } catch (error) {
setErrorMsg(error?.message || 'Invalid embed link'); setErrorMsg(
error?.message ||
t('core:message.error.invalid_embed_link', {
postProcess: 'capitalizeFirst',
})
);
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }
@ -309,7 +319,12 @@ export const Embed = ({ embedLink }) => {
break; break;
} }
} catch (error) { } catch (error) {
setErrorMsg(error?.message || 'Invalid embed link'); setErrorMsg(
error?.message ||
t('core:message.error.invalid_embed_link', {
postProcess: 'capitalizeFirst',
})
);
} }
}; };
@ -318,7 +333,12 @@ export const Embed = ({ embedLink }) => {
const parsedData = parseQortalLink(embedLink); const parsedData = parseQortalLink(embedLink);
handleImage(parsedData); handleImage(parsedData);
} catch (error) { } catch (error) {
setErrorMsg(error?.message || 'Invalid embed link'); setErrorMsg(
error?.message ||
t('core:message.error.invalid_embed_link', {
postProcess: 'capitalizeFirst',
})
);
} }
}; };

View File

@ -898,7 +898,9 @@ export const ListOfGroupPromotions = () => {
labelId="demo-simple-select-label" labelId="demo-simple-select-label"
id="demo-simple-select" id="demo-simple-select"
value={selectedGroup} value={selectedGroup}
label="Groups where you are an admin" label={t('group:group.groups_admin', {
postProcess: 'capitalizeFirst',
})}
onChange={(e) => setSelectedGroup(e.target.value)} onChange={(e) => setSelectedGroup(e.target.value)}
variant="outlined" variant="outlined"
> >

View File

@ -81,7 +81,10 @@
"update_app": "update your app" "update_app": "update your app"
}, },
"admin": "admin", "admin": "admin",
"admin_other": "admins",
"all": "all", "all": "all",
"announcement": "announcement",
"announcement_other": "announcements",
"api": "API", "api": "API",
"app": "app", "app": "app",
"app_other": "apps", "app_other": "apps",
@ -117,6 +120,7 @@
"publish": "publish fee" "publish": "publish fee"
}, },
"for": "for", "for": "for",
"general": "general",
"general_settings": "general settings", "general_settings": "general settings",
"identifier": "identifier", "identifier": "identifier",
"last_height": "last height", "last_height": "last height",
@ -128,12 +132,14 @@
"member": "member list" "member": "member list"
}, },
"loading": { "loading": {
"announcements": "announcements", "announcements": "loading announcements",
"generic": "loading...", "generic": "loading...",
"chat": "loading chat... please wait.", "chat": "loading chat... please wait.",
"comments": "loading comments... please wait.", "comments": "loading comments... please wait.",
"posts": "loading posts... please wait." "posts": "loading posts... please wait."
}, },
"member": "member",
"member_other": "members",
"message_us": "please message us on Telegram or Discord if you need 4 QORT to start chatting without any limitations", "message_us": "please message us on Telegram or Discord if you need 4 QORT to start chatting without any limitations",
"message": { "message": {
"error": { "error": {
@ -142,7 +148,8 @@
"file_too_large": "file {{ filename }} is too large. Max size allowed is {{ size }} MB.", "file_too_large": "file {{ filename }} is too large. Max size allowed is {{ size }} MB.",
"generic": "an error occurred", "generic": "an error occurred",
"invalid_embed_link": "invalid embed link", "invalid_embed_link": "invalid embed link",
"invalid_embed_link_name": "invalid poll embed link. Missing name.", "invalid_poll_embed_link_name": "invalid poll embed link. Missing name.",
"invalid_image_embed_link_name": "invalid image embed link. Missing param.",
"invalid_signature": "invalid signature", "invalid_signature": "invalid signature",
"invalid_zip": "invalid zip", "invalid_zip": "invalid zip",
"message_loading": "error loading message.", "message_loading": "error loading message.",
@ -158,6 +165,7 @@
"rating_option": "cannot find rating option", "rating_option": "cannot find rating option",
"save_qdn": "unable to save to QDN", "save_qdn": "unable to save to QDN",
"send_failed": "failed to send", "send_failed": "failed to send",
"unable_download_image": "unable to download IMAGE. Please try again later by clicking the refresh button",
"unable_encrypt_app": "unable to encrypt app. App not published'", "unable_encrypt_app": "unable to encrypt app. App not published'",
"unable_publish_app": "unable to publish app", "unable_publish_app": "unable to publish app",
"unable_publish_image": "unable to publish image", "unable_publish_image": "unable to publish image",
@ -281,6 +289,8 @@
"dark": "dark mode", "dark": "dark mode",
"light": "light mode" "light": "light mode"
}, },
"thread": "thread",
"thread_other": "threads",
"time": { "time": {
"day_one": "{{count}} day", "day_one": "{{count}} day",
"day_other": "{{count}} days", "day_other": "{{count}} days",