From d93262fc92b3af943de785e3fddeded278b73e82 Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Fri, 16 May 2025 07:46:38 +0200 Subject: [PATCH] Translation for appRating --- src/components/Apps/AppRating.tsx | 29 +++++++++++++++++++++-------- src/i18n/locales/en/core.json | 5 ++++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/components/Apps/AppRating.tsx b/src/components/Apps/AppRating.tsx index 8894f3c..7252c1f 100644 --- a/src/components/Apps/AppRating.tsx +++ b/src/components/Apps/AppRating.tsx @@ -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' }) => {
@@ -222,8 +232,11 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => { (votesInfo?.voteCounts?.length === 6 ? 1 : 0)}{' '} {' RATINGS'} + + {value?.toFixed(1)} + )} diff --git a/src/i18n/locales/en/core.json b/src/i18n/locales/en/core.json index 23c5fce..90f00b6 100644 --- a/src/i18n/locales/en/core.json +++ b/src/i18n/locales/en/core.json @@ -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!" }