Add translations to app

This commit is contained in:
Nicola Benaglia 2025-04-24 20:32:00 +02:00
parent 6b1e15a58d
commit 02ac187675
4 changed files with 64 additions and 30 deletions

View File

@ -1,15 +1,20 @@
{ {
"action": { "action": {
"add": "add", "add": "add",
"accept": "accept",
"cancel": "cancel", "cancel": "cancel",
"change": "change", "change": "change",
"choose": "choose", "choose": "choose",
"close": "close", "close": "close",
"continue": "continue", "continue": "continue",
"continue_logout": "continue to logout",
"decline": "decline",
"edit": "edit", "edit": "edit",
"export": "export", "export": "export",
"import": "import", "import": "import",
"logout": "logout" "logout": "logout",
"refetch_page": "refetch page",
"return_to_thread": "return to threads"
}, },
"core": { "core": {
"block_height": "block height", "block_height": "block height",
@ -18,25 +23,23 @@
"version": "core version" "version": "core version"
}, },
"description": "description", "description": "description",
"fee": {
"payment": "payment fee",
"publish": "publish fee"
},
"page": { "page": {
"last": "last", "last": "last",
"first": "first", "first": "first",
"previous": "previous" "previous": "previous"
}, },
"downloading_qdn": "downloading from QDN", "downloading_qdn": "downloading from QDN",
"edit": "edit",
"export": "export",
"import": "import",
"last_height": "last height", "last_height": "last height",
"loading": "loading...", "loading": "loading...",
"loading_posts": "loading posts... please wait.", "loading_posts": "loading posts... please wait.",
"logout": "logout",
"minting_status": "minting status", "minting_status": "minting status",
"next": "next", "next": "next",
"payment_notification": "payment notification", "payment_notification": "payment notification",
"price": "price", "price": "price",
"refetch_page": "refetch page",
"return_to_thread": "return to Threads",
"q_mail": "q-mail", "q_mail": "q-mail",
"result": { "result": {
"error": { "error": {
@ -51,9 +54,14 @@
"synchronizing": "synchronizing" "synchronizing": "synchronizing"
}, },
"success": { "success": {
"publish_qdn": "successfully published to QDN" "group_creation": "successfully created group. It may take a couple of minutes for the changes to propagate",
"publish_qdn": "successfully published to QDN",
"request_read": "I have read this request"
} }
}, },
"question": {
"perform_create_group": "would you like to perform an CREATE_GROUP transaction?"
},
"save_options": { "save_options": {
"no_pinned_changes": "you currently do not have any changes to your pinned apps", "no_pinned_changes": "you currently do not have any changes to your pinned apps",
"overwrite_changes": "the app was unable to download your existing QDN-saved pinned apps. Would you like to overwrite those changes?", "overwrite_changes": "the app was unable to download your existing QDN-saved pinned apps. Would you like to overwrite those changes?",

View File

@ -2079,7 +2079,6 @@ function App() {
/> />
</Box> </Box>
)} )}
{isShowQortalRequest && !isMainWindow && ( {isShowQortalRequest && !isMainWindow && (
<> <>
<Spacer height="120px" /> <Spacer height="120px" />
@ -2362,7 +2361,6 @@ function App() {
<ErrorText>{sendPaymentError}</ErrorText> <ErrorText>{sendPaymentError}</ErrorText>
</> </>
)} )}
{extState === 'web-app-request-payment' && !isMainWindow && ( {extState === 'web-app-request-payment' && !isMainWindow && (
<> <>
<Spacer height="100px" /> <Spacer height="100px" />
@ -3176,8 +3174,9 @@ function App() {
> >
Close Close
</CustomButton> </CustomButton>
</> </> // TODO translate
)} )}
{countdown && ( {countdown && (
<Box <Box
style={{ style={{
@ -3221,12 +3220,18 @@ function App() {
</DialogContentText> </DialogContentText>
{message?.paymentFee && ( {message?.paymentFee && (
<DialogContentText id="alert-dialog-description2"> <DialogContentText id="alert-dialog-description2">
payment fee: {message.paymentFee} {t('core:fee.payment', {
postProcess: 'capitalize',
})}
: {message.paymentFee}
</DialogContentText> </DialogContentText>
)} )}
{message?.publishFee && ( {message?.publishFee && (
<DialogContentText id="alert-dialog-description2"> <DialogContentText id="alert-dialog-description2">
publish fee: {message.publishFee} {t('core:fee.publish', {
postProcess: 'capitalize',
})}
: {message.publishFee}
</DialogContentText> </DialogContentText>
)} )}
</DialogContent> </DialogContent>
@ -3247,7 +3252,9 @@ function App() {
onClick={onOk} onClick={onOk}
autoFocus autoFocus
> >
accept {t('core:action.accept', {
postProcess: 'capitalize',
})}
</Button> </Button>
<Button <Button
sx={{ sx={{
@ -3264,7 +3271,9 @@ function App() {
variant="contained" variant="contained"
onClick={onCancel} onClick={onCancel}
> >
decline {t('core:action.decline', {
postProcess: 'capitalize',
})}
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
@ -3285,7 +3294,9 @@ function App() {
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<Button variant="contained" onClick={onOkInfo} autoFocus> <Button variant="contained" onClick={onOkInfo} autoFocus>
Close {t('core:action.close', {
postProcess: 'capitalize',
})}
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
@ -3304,14 +3315,18 @@ function App() {
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<Button variant="contained" onClick={onCancelUnsavedChanges}> <Button variant="contained" onClick={onCancelUnsavedChanges}>
Cancel {t('core:action.cancel', {
postProcess: 'capitalize',
})}
</Button> </Button>
<Button <Button
variant="contained" variant="contained"
onClick={onOkUnsavedChanges} onClick={onOkUnsavedChanges}
autoFocus autoFocus
> >
Continue to Logout {t('core:action.decline', {
postProcess: 'capitalize',
})}
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
@ -3582,10 +3597,12 @@ function App() {
label={ label={
<Box sx={{ display: 'flex', alignItems: 'center' }}> <Box sx={{ display: 'flex', alignItems: 'center' }}>
<Typography sx={{ fontSize: '14px' }}> <Typography sx={{ fontSize: '14px' }}>
I have read this request {t('core:result.success.request_read', {
postProcess: 'capitalize',
})}
</Typography> </Typography>
<PriorityHighIcon color="warning" /> <PriorityHighIcon color="warning" />
</Box> // TODO translate </Box>
} }
/> />
)} )}
@ -3593,8 +3610,8 @@ function App() {
<Spacer height="29px" /> <Spacer height="29px" />
<Box <Box
sx={{ sx={{
display: 'flex',
alignItems: 'center', alignItems: 'center',
display: 'flex',
gap: '14px', gap: '14px',
}} }}
> >
@ -3630,7 +3647,9 @@ function App() {
onOkQortalRequestExtension('accepted'); onOkQortalRequestExtension('accepted');
}} }}
> >
accept {t('core:action.accept', {
postProcess: 'capitalize',
})}
</CustomButtonAccept> </CustomButtonAccept>
<CustomButtonAccept <CustomButtonAccept
color="black" color="black"
@ -3640,7 +3659,9 @@ function App() {
}} }}
onClick={() => onCancelQortalRequestExtension()} onClick={() => onCancelQortalRequestExtension()}
> >
decline {t('core:action.decline', {
postProcess: 'capitalize',
})}
</CustomButtonAccept> </CustomButtonAccept>
</Box> </Box>
<ErrorText>{sendPaymentError}</ErrorText> <ErrorText>{sendPaymentError}</ErrorText>

View File

@ -28,6 +28,7 @@ import { CustomizedSnackbars } from '../Snackbar/Snackbar';
import { getFee } from '../../background'; import { getFee } from '../../background';
import { MyContext } from '../../App'; import { MyContext } from '../../App';
import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events'; import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
import { useTranslation } from 'react-i18next';
export const Label = styled('label')` export const Label = styled('label')`
display: block; display: block;
@ -84,6 +85,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
setMaxBlock(event.target.value as string); setMaxBlock(event.target.value as string);
}; };
const { t } = useTranslation(['core']);
const theme = useTheme(); const theme = useTheme();
const handleCreateGroup = async () => { const handleCreateGroup = async () => {
@ -91,9 +93,11 @@ export const AddGroup = ({ address, open, setOpen }) => {
if (!name) throw new Error('Please provide a name'); if (!name) throw new Error('Please provide a name');
if (!description) throw new Error('Please provide a description'); if (!description) throw new Error('Please provide a description');
const fee = await getFee('CREATE_GROUP'); // TODO translate const fee = await getFee('CREATE_GROUP');
await show({ await show({
message: 'Would you like to perform an CREATE_GROUP transaction?', message: t('core:question.perform_create_group', {
postProcess: 'capitalize',
}),
publishFee: fee.fee + ' QORT', publishFee: fee.fee + ' QORT',
}); });
@ -111,10 +115,11 @@ export const AddGroup = ({ address, open, setOpen }) => {
if (!response?.error) { if (!response?.error) {
setInfoSnack({ setInfoSnack({
type: 'success', type: 'success',
message: message: t('core:result.success.group_creation', {
'Successfully created group. It may take a couple of minutes for the changes to propagate', postProcess: 'capitalize',
}),
}); });
setOpenSnack(true); setOpenSnack(true); // TODO translate
setTxList((prev) => [ setTxList((prev) => [
{ {
...response, ...response,

View File

@ -608,7 +608,7 @@ export const Thread = ({
> >
<MailIconImg src={ReturnSVG} /> <MailIconImg src={ReturnSVG} />
<ComposeP> <ComposeP>
{t('core:return_to_thread', { postProcess: 'capitalize' })} {t('core:action.return_to_thread', { postProcess: 'capitalize' })}
</ComposeP> </ComposeP>
</ShowMessageReturnButton> </ShowMessageReturnButton>
{/* Conditionally render the scroll buttons */} {/* Conditionally render the scroll buttons */}
@ -960,7 +960,7 @@ export const Thread = ({
color: 'white', color: 'white',
}} }}
> >
{t('core:refetch_page', { postProcess: 'capitalize' })} {t('core:action.refetch_page', { postProcess: 'capitalize' })}
</Button> </Button>
</Box> </Box>
</> </>