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
id="demo-simple-select"
label="By member"
label={t('core:sort.by_member', {
postProcess: 'capitalizeFirst',
})}
labelId="demo-simple-select-label"
onChange={(e) => setSelectedMember(e.target.value)}
size="small"

View File

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

View File

@ -107,7 +107,7 @@ export const Embed = ({ embedLink }) => {
setType('POLL');
if (!parsedData?.name)
throw new Error(
t('core:message.error.invalid_embed_link_name', {
t('core:message.error.invalid_poll_embed_link_name', {
postProcess: 'capitalizeFirst',
})
);
@ -237,9 +237,10 @@ export const Embed = ({ embedLink }) => {
if (imageFinalUrl) {
return imageFinalUrl;
} else {
//TODO translate
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;
}
@ -248,7 +249,7 @@ export const Embed = ({ embedLink }) => {
setErrorMsg(
error?.error ||
error?.message ||
'An unexpected error occurred while trying to download the image'
t('core:message.error.generic', { postProcess: 'capitalizeFirst' })
);
return null;
}
@ -259,7 +260,11 @@ export const Embed = ({ embedLink }) => {
setIsLoading(true);
setErrorMsg('');
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(
{
name: parsedData.name,
@ -272,7 +277,12 @@ export const Embed = ({ embedLink }) => {
setImageUrl(image);
} catch (error) {
setErrorMsg(error?.message || 'Invalid embed link');
setErrorMsg(
error?.message ||
t('core:message.error.invalid_embed_link', {
postProcess: 'capitalizeFirst',
})
);
} finally {
setIsLoading(false);
}
@ -309,7 +319,12 @@ export const Embed = ({ embedLink }) => {
break;
}
} 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);
handleImage(parsedData);
} 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"
id="demo-simple-select"
value={selectedGroup}
label="Groups where you are an admin"
label={t('group:group.groups_admin', {
postProcess: 'capitalizeFirst',
})}
onChange={(e) => setSelectedGroup(e.target.value)}
variant="outlined"
>

View File

@ -81,7 +81,10 @@
"update_app": "update your app"
},
"admin": "admin",
"admin_other": "admins",
"all": "all",
"announcement": "announcement",
"announcement_other": "announcements",
"api": "API",
"app": "app",
"app_other": "apps",
@ -117,6 +120,7 @@
"publish": "publish fee"
},
"for": "for",
"general": "general",
"general_settings": "general settings",
"identifier": "identifier",
"last_height": "last height",
@ -128,12 +132,14 @@
"member": "member list"
},
"loading": {
"announcements": "announcements",
"announcements": "loading announcements",
"generic": "loading...",
"chat": "loading chat... please wait.",
"comments": "loading comments... 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": {
"error": {
@ -142,7 +148,8 @@
"file_too_large": "file {{ filename }} is too large. Max size allowed is {{ size }} MB.",
"generic": "an error occurred",
"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_zip": "invalid zip",
"message_loading": "error loading message.",
@ -158,6 +165,7 @@
"rating_option": "cannot find rating option",
"save_qdn": "unable to save to QDN",
"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_publish_app": "unable to publish app",
"unable_publish_image": "unable to publish image",
@ -281,6 +289,8 @@
"dark": "dark mode",
"light": "light mode"
},
"thread": "thread",
"thread_other": "threads",
"time": {
"day_one": "{{count}} day",
"day_other": "{{count}} days",