Translation for appRating

This commit is contained in:
Nicola Benaglia 2025-05-16 07:46:38 +02:00
parent e94ff9ef09
commit d93262fc92
2 changed files with 25 additions and 9 deletions

View File

@ -149,10 +149,11 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
res(response);
setInfoSnack({
type: 'success',
message:
'Successfully rated. Please wait a couple minutes for the network to propogate the changes.',
message: t('core:message.success.rated_app', {
postProcess: 'capitalize',
}),
});
setOpenSnack(true); // TODO translate
setOpenSnack(true);
}
})
.catch((error) => {
@ -166,7 +167,11 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
(option) => +option.optionName === +newValue
);
if (isNaN(optionIndex) || optionIndex === -1)
throw new Error('Cannot find rating option');
throw new Error(
t('core:message.error.rating_option', {
postProcess: 'capitalize',
})
);
await new Promise((res, rej) => {
window
.sendMessage(
@ -185,8 +190,9 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
res(response);
setInfoSnack({
type: 'success',
message:
'Successfully rated. Please wait a couple minutes for the network to propogate the changes.',
message: t('core:message.success.rated_app', {
postProcess: 'capitalize',
}),
});
setOpenSnack(true);
}
@ -200,7 +206,11 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
console.log('error', error);
setInfoSnack({
type: 'error',
message: error?.message || 'Unable to rate',
message:
error?.message ||
t('core:message.error.unable_rate', {
postProcess: 'capitalize',
}),
});
setOpenSnack(true);
}
@ -210,8 +220,8 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
<div>
<Box
sx={{
display: 'flex',
alignItems: 'center',
display: 'flex',
flexDirection: ratingCountPosition === 'top' ? 'column' : 'row',
}}
>
@ -222,8 +232,11 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
(votesInfo?.voteCounts?.length === 6 ? 1 : 0)}{' '}
{' RATINGS'}
</AppInfoUserName>
<Spacer height="6px" />
<AppInfoUserName>{value?.toFixed(1)}</AppInfoUserName>
<Spacer height="6px" />
</>
)}

View File

@ -92,7 +92,9 @@
"minting_account_remove": "unable to remove minting account",
"missing_fields": "missing: {{ fields }}",
"publish_app": "unable to publish app",
"save_qdn": "unable to save to QDN"
"rating_option": "cannot find rating option",
"save_qdn": "unable to save to QDN",
"unable_rate": "unable to rate"
},
"generic": {
"name_available": "{{ name }} is available",
@ -123,6 +125,7 @@
"order_submitted": "your buy order was submitted",
"published": "successfully published. Please wait a couple minutes for the network to propogate the changes.",
"published_qdn": "successfully published to QDN",
"rated_app": "successfully rated. Please wait a couple minutes for the network to propogate the changes.",
"request_read": "I have read this request",
"transfer": "the transfer was succesful!"
}