Add theme translations

This commit is contained in:
Nicola Benaglia 2025-05-21 20:22:10 +02:00
parent 4abaf06489
commit 95f35d4e30
8 changed files with 75 additions and 28 deletions

View File

@ -94,7 +94,10 @@ export const DesktopFooter = ({
goToHome(); goToHome();
}} }}
> >
<IconWrapper label="Home" selected={isHome}> <IconWrapper
label={t('core:home', { postProcess: 'capitalizeFirstChar' })}
selected={isHome}
>
<HomeIcon height={30} /> <HomeIcon height={30} />
</IconWrapper> </IconWrapper>
</ButtonBase> </ButtonBase>
@ -145,7 +148,12 @@ export const DesktopFooter = ({
setDesktopSideView('directs'); setDesktopSideView('directs');
}} }}
> >
<IconWrapper label="Messaging" selected={isDirects}> <IconWrapper
label={t('group:group.messaging', {
postProcess: 'capitalizeFirstChar',
})}
selected={isDirects}
>
<MessagingIcon <MessagingIcon
height={30} height={30}
color={ color={
@ -168,7 +176,10 @@ export const DesktopFooter = ({
setIsOpenSideViewGroups(false); setIsOpenSideViewGroups(false);
}} }}
> >
<IconWrapper label="Dev Mode" selected={isApps}> <IconWrapper
label={t('core:dev_mode', { postProcess: 'capitalizeFirstChar' })}
selected={isApps}
>
<img src={AppIcon} /> <img src={AppIcon} />
</IconWrapper> </IconWrapper>
</ButtonBase> </ButtonBase>

View File

@ -388,7 +388,9 @@ export const AddGroup = ({ address, open, setOpen }) => {
labelId="demo-simple-select-label" labelId="demo-simple-select-label"
id="demo-simple-select" id="demo-simple-select"
value={groupType} value={groupType}
label="Group Type" label={t('group:group.type', {
postProcess: 'capitalizeFirstChar',
})}
onChange={handleChangeGroupType} onChange={handleChangeGroupType}
> >
<MenuItem value={1}> <MenuItem value={1}>
@ -469,7 +471,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
}} }}
> >
<Label> <Label>
{t('group:block_delay.minimum', { {t('group:message.generic.block_delay_minimum', {
postProcess: 'capitalizeFirstChar', postProcess: 'capitalizeFirstChar',
})} })}
</Label> </Label>
@ -478,7 +480,9 @@ export const AddGroup = ({ address, open, setOpen }) => {
labelId="demo-simple-select-label" labelId="demo-simple-select-label"
id="demo-simple-select" id="demo-simple-select"
value={minBlock} value={minBlock}
label="Minimum Block delay" label={t('group:block_delay.minimum', {
postProcess: 'capitalizeFirstChar',
})}
onChange={handleChangeMinBlock} onChange={handleChangeMinBlock}
> >
<MenuItem value={5}> <MenuItem value={5}>
@ -528,7 +532,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
}} }}
> >
<Label> <Label>
{t('group:block_delay.maximum', { {t('group:message.generic.block_delay_maximum', {
postProcess: 'capitalizeFirstChar', postProcess: 'capitalizeFirstChar',
})} })}
</Label> </Label>
@ -537,7 +541,9 @@ export const AddGroup = ({ address, open, setOpen }) => {
labelId="demo-simple-select-label" labelId="demo-simple-select-label"
id="demo-simple-select" id="demo-simple-select"
value={maxBlock} value={maxBlock}
label="Maximum Block delay" label={t('group:block_delay.minimum', {
postProcess: 'capitalizeFirstChar',
})}
onChange={handleChangeMaxBlock} onChange={handleChangeMaxBlock}
> >
<MenuItem value={60}> <MenuItem value={60}>

View File

@ -1680,7 +1680,9 @@ export const Group = ({
? theme.palette.text.primary ? theme.palette.text.primary
: theme.palette.text.secondary : theme.palette.text.secondary
} }
label="Messaging" label={t('group:group.messaging', {
postProcess: 'capitalizeFirstChar',
})}
selected={desktopSideView === 'directs'} selected={desktopSideView === 'directs'}
> >
<MessagingIcon <MessagingIcon

View File

@ -216,7 +216,7 @@ export const Settings = ({ open, setOpen, rawWallet }) => {
}} }}
/> />
} }
label={t('group:action.enable_dev_mode', { label={t('core:action.enable_dev_mode', {
postProcess: 'capitalizeFirstChar', postProcess: 'capitalizeFirstChar',
})} })}
/> />

View File

@ -105,8 +105,6 @@ export const ReactionPicker = ({ onReaction }) => {
height={400} height={400}
onEmojiClick={handlePicker} onEmojiClick={handlePicker}
onReactionClick={handleReaction} onReactionClick={handleReaction}
// reactionsDefaultOpen={true}
// open={true}
theme={Theme.DARK} theme={Theme.DARK}
width={350} width={350}
/> />

View File

@ -1,4 +1,4 @@
import React, { useState, useRef, useEffect } from 'react'; import { useState, useRef, useEffect } from 'react';
import { import {
Box, Box,
Button, Button,
@ -29,6 +29,8 @@ import { rgbStringToHsva, rgbaStringToHsva } from '@uiw/color-convert';
import FileDownloadIcon from '@mui/icons-material/FileDownload'; import FileDownloadIcon from '@mui/icons-material/FileDownload';
import { saveFileToDiskGeneric } from '../../utils/generateWallet/generateWallet'; import { saveFileToDiskGeneric } from '../../utils/generateWallet/generateWallet';
import { handleImportClick } from '../../utils/fileReading'; import { handleImportClick } from '../../utils/fileReading';
import { useTranslation } from 'react-i18next';
const uid = new ShortUniqueId({ length: 8 }); const uid = new ShortUniqueId({ length: 8 });
function detectColorFormat(color) { function detectColorFormat(color) {
@ -80,6 +82,7 @@ export default function ThemeManager() {
}); });
const [currentTab, setCurrentTab] = useState('light'); const [currentTab, setCurrentTab] = useState('light');
const nameInputRef = useRef(null); const nameInputRef = useRef(null);
const { t } = useTranslation(['auth', 'core', 'group']);
useEffect(() => { useEffect(() => {
if (openEditor && nameInputRef.current) { if (openEditor && nameInputRef.current) {
@ -208,7 +211,11 @@ export default function ThemeManager() {
const fileContent = await handleImportClick('.json'); const fileContent = await handleImportClick('.json');
const importedTheme = JSON.parse(fileContent); const importedTheme = JSON.parse(fileContent);
if (!validateTheme(importedTheme)) { if (!validateTheme(importedTheme)) {
throw new Error('Invalid theme format'); throw new Error(
t('core:message.generic.invalid_theme_format', {
postProcess: 'capitalizeFirstChar',
})
);
} }
const newTheme = { ...importedTheme, id: uid.rnd() }; const newTheme = { ...importedTheme, id: uid.rnd() };
const updatedThemes = [...userThemes, newTheme]; const updatedThemes = [...userThemes, newTheme];
@ -223,7 +230,7 @@ export default function ThemeManager() {
return ( return (
<Box p={2}> <Box p={2}>
<Typography variant="h5" gutterBottom> <Typography variant="h5" gutterBottom>
Theme Manager {t('core:theme.manager', { postProcess: 'capitalizeFirstChar' })}
</Typography> </Typography>
<Button <Button
@ -231,8 +238,9 @@ export default function ThemeManager() {
startIcon={<AddIcon />} startIcon={<AddIcon />}
onClick={handleAddTheme} onClick={handleAddTheme}
> >
Add Theme {t('core:action.add_theme', { postProcess: 'capitalizeFirstChar' })}
</Button> </Button>
<Button <Button
sx={{ sx={{
marginLeft: '20px', marginLeft: '20px',
@ -241,8 +249,9 @@ export default function ThemeManager() {
startIcon={<AddIcon />} startIcon={<AddIcon />}
onClick={importTheme} onClick={importTheme}
> >
Import theme {t('core:action.import_theme', { postProcess: 'capitalizeFirstChar' })}
</Button> </Button>
<List> <List>
{userThemes?.map((theme, index) => ( {userThemes?.map((theme, index) => (
<ListItemButton <ListItemButton
@ -281,13 +290,20 @@ export default function ThemeManager() {
maxWidth="md" maxWidth="md"
> >
<DialogTitle> <DialogTitle>
{themeDraft.id ? 'Edit Theme' : 'Add New Theme'} {themeDraft.id
? t('core:action.edit_theme', {
postProcess: 'capitalizeFirstChar',
})
: t('core:action.new.theme', {
postProcess: 'capitalizeFirstChar',
})}
</DialogTitle> </DialogTitle>
<DialogContent> <DialogContent>
<TextField <TextField
inputRef={nameInputRef} inputRef={nameInputRef}
margin="dense" margin="dense"
label="Theme Name" label={t('core:theme.name', { postProcess: 'capitalizeFirstChar' })}
fullWidth fullWidth
value={themeDraft.name} value={themeDraft.name}
onChange={(e) => onChange={(e) =>
@ -391,14 +407,17 @@ export default function ThemeManager() {
)} )}
</Box> </Box>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<Button onClick={() => setOpenEditor(false)}>Cancel</Button> <Button onClick={() => setOpenEditor(false)}>
{t('core:action.cancel', { postProcess: 'capitalizeFirstChar' })}
</Button>
<Button <Button
disabled={!themeDraft.name} disabled={!themeDraft.name}
onClick={handleSaveTheme} onClick={handleSaveTheme}
variant="contained" variant="contained"
> >
Save {t('core:action.save', { postProcess: 'capitalizeFirstChar' })}
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>

View File

@ -1,11 +1,12 @@
{ {
"action": { "action": {
"add": "add",
"add_custom_framework": "add custom framework",
"add_reaction": "add reaction",
"accept": "accept", "accept": "accept",
"access": "access", "access": "access",
"access_app": "access app", "access_app": "access app",
"add": "add",
"add_custom_framework": "add custom framework",
"add_reaction": "add reaction",
"add_theme": "add theme",
"backup_account": "backup account", "backup_account": "backup account",
"backup_wallet": "backup wallet", "backup_wallet": "backup wallet",
"cancel": "cancel", "cancel": "cancel",
@ -33,11 +34,14 @@
"download": "download", "download": "download",
"download_file": "download file", "download_file": "download file",
"edit": "edit", "edit": "edit",
"edit_theme": "edit theme",
"enable_dev_mode": "enable dev mode",
"enter_name": "enter a name", "enter_name": "enter a name",
"export": "export", "export": "export",
"get_qort": "get QORT at Q-Trade", "get_qort": "get QORT at Q-Trade",
"hide": "hide", "hide": "hide",
"import": "import", "import": "import",
"import_theme": "import theme",
"invite": "invite", "invite": "invite",
"join": "join", "join": "join",
"leave_comment": "leave comment", "leave_comment": "leave comment",
@ -47,6 +51,7 @@
"new": { "new": {
"chat": "new chat", "chat": "new chat",
"post": "new post", "post": "new post",
"theme": "new theme",
"thread": "new thread" "thread": "new thread"
}, },
"notify": "notify", "notify": "notify",
@ -115,6 +120,7 @@
}, },
"current_language": "current language: {{ language }}", "current_language": "current language: {{ language }}",
"dev": "dev", "dev": "dev",
"dev_mode": "dev Mode",
"domain": "domain", "domain": "domain",
"ui": { "ui": {
"version": "UI version" "version": "UI version"
@ -134,6 +140,7 @@
"for": "for", "for": "for",
"general": "general", "general": "general",
"general_settings": "general settings", "general_settings": "general settings",
"home": "home",
"identifier": "identifier", "identifier": "identifier",
"image_embed": "image embed", "image_embed": "image embed",
"last_height": "last height", "last_height": "last height",
@ -164,6 +171,7 @@
"invalid_poll_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_image_embed_link_name": "invalid image embed link. Missing param.",
"invalid_signature": "invalid signature", "invalid_signature": "invalid signature",
"invalid_theme_format": "invalid theme format",
"invalid_zip": "invalid zip", "invalid_zip": "invalid zip",
"message_loading": "error loading message.", "message_loading": "error loading message.",
"message_size": "your message size is of {{ size }} bytes out of a maximum of {{ maximum }}", "message_size": "your message size is of {{ size }} bytes out of a maximum of {{ maximum }}",
@ -326,7 +334,9 @@
"tags": "tags", "tags": "tags",
"theme": { "theme": {
"dark": "dark mode", "dark": "dark mode",
"light": "light mode" "light": "light mode",
"manager": "theme Manager",
"name": "theme name"
}, },
"thread": "thread", "thread": "thread",
"thread_other": "threads", "thread_other": "threads",

View File

@ -6,7 +6,6 @@
"copy_private_key": "copy private key", "copy_private_key": "copy private key",
"create_group": "create group", "create_group": "create group",
"disable_push_notifications": "disable all push notifications", "disable_push_notifications": "disable all push notifications",
"enable_dev_mode": "enable dev mode",
"export_password": "export password", "export_password": "export password",
"export_private_key": "export private key", "export_private_key": "export private key",
"find_group": "find group", "find_group": "find group",
@ -33,8 +32,8 @@
"approval_threshold": "group Approval Threshold (number / percentage of Admins that must approve a transaction)", "approval_threshold": "group Approval Threshold (number / percentage of Admins that must approve a transaction)",
"ban_list": "ban list", "ban_list": "ban list",
"block_delay": { "block_delay": {
"minimum": "minimum Block delay for Group Transaction Approvals", "minimum": "Minimum Block delay",
"maximum": "maximum Block delay for Group Transaction Approvals" "maximum": "Maximum Block delay"
}, },
"group": { "group": {
"avatar": "group avatar", "avatar": "group avatar",
@ -68,6 +67,8 @@
"avatar_registered_name": "a registered name is required to set an avatar", "avatar_registered_name": "a registered name is required to set an avatar",
"admin_only": "only groups where you are an admin will be shown", "admin_only": "only groups where you are an admin will be shown",
"already_in_group": "you are already in this group!", "already_in_group": "you are already in this group!",
"block_delay_minimum": "minimum Block delay for Group Transaction Approvals",
"block_delay_maximum": "maximum Block delay for Group Transaction Approvals",
"closed_group": "this is a closed/private group, so you will need to wait until an admin accepts your request", "closed_group": "this is a closed/private group, so you will need to wait until an admin accepts your request",
"descrypt_wallet": "decrypting wallet...", "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...", "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...",