From 51c65e82366557ffacc8ed98ebc34a328a270956 Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Sat, 26 Apr 2025 07:38:19 +0200 Subject: [PATCH] Translation for addGroup page --- public/locales/en/core.json | 16 +- public/locales/en/group.json | 59 +++---- src/components/Group/AddGroup.tsx | 213 +++++++++++++++++------ src/components/Group/Forum/NewThread.tsx | 6 +- 4 files changed, 203 insertions(+), 91 deletions(-) diff --git a/public/locales/en/core.json b/public/locales/en/core.json index 1b6529f..c640b7b 100644 --- a/public/locales/en/core.json +++ b/public/locales/en/core.json @@ -24,6 +24,10 @@ "peers": "connected peers", "version": "core version" }, + "count": { + "none": "none", + "one": "one" + }, "description": "description", "fee": { "payment": "payment fee", @@ -56,16 +60,12 @@ "synchronizing": "synchronizing" }, "success": { - "group_creation": "successfully created group. It may take a couple of minutes for the changes to propagate", "order_submitted": "your buy order was submitted", "publish_qdn": "successfully published to QDN", "request_read": "I have read this request", "transfer": "the transfer was succesful!" } }, - "question": { - "perform_create_group": "would you like to perform an CREATE_GROUP transaction?" - }, "save_options": { "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?", @@ -88,6 +88,14 @@ "dark": "dark mode", "light": "light mode" }, + "time": { + "day_one": "{{count}} day", + "day_other": "{{count}} days", + "hour_one": "{{count}} hour", + "hour_other": "{{count}} hours", + "minute_one": "{{count}} minute", + "minute_other": "{{count}} minutes" + }, "title": "title", "tutorial": "tutorial", "user_lookup": "user lookup", diff --git a/public/locales/en/group.json b/public/locales/en/group.json index 21d11c4..3bc248e 100644 --- a/public/locales/en/group.json +++ b/public/locales/en/group.json @@ -1,39 +1,38 @@ { "action": { + "create_group": "create group", + "find_group": "find group", "return_to_thread": "return to threads" }, - "group_invites": "group invites", - "provide_thread": "please provide a thread title", + "advanced_options": "advanced options", + "approval_threshold": "group Approval Threshold (number / percentage of Admins that must approve a transaction)", + "block_delay": { + "minimum": "minimum Block delay for Group Transaction Approvals", + "maximum": "maximum Block delay for Group Transaction Approvals" + }, + "group": { + "closed": "closed (private) - users need permission to join", + "description": "description of group", + "invites": "group invites", + "management": "group management", + "name": "name of group", + "open": "open (public)", + "type": "group type" + }, + "question": { + "create_group": "would you like to perform an CREATE_GROUP transaction?", + "provide_thread": "please provide a thread title" + }, "result": { - "cannot": { + "error": { "access_name": "Cannot send a message without a access to your name", "group_info": "Cannot access group information" }, - "loading_threads": "loading threads... please wait." - }, - - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "", - "": "" + "loading_threads": "loading threads... please wait.", + "success": { + "group_creation": "successfully created group. It may take a couple of minutes for the changes to propagate", + "group_creation_name": "created group {{group_name}}: awaiting confirmation", + "group_creation_label": "created group {{name}}: success!" + } + } } diff --git a/src/components/Group/AddGroup.tsx b/src/components/Group/AddGroup.tsx index a603f81..6b45d00 100644 --- a/src/components/Group/AddGroup.tsx +++ b/src/components/Group/AddGroup.tsx @@ -93,7 +93,7 @@ export const AddGroup = ({ address, open, setOpen }) => { setMaxBlock(event.target.value as string); }; - const { t } = useTranslation(['core']); + const { t } = useTranslation(['core', 'group']); const theme = useTheme(); const handleCreateGroup = async () => { @@ -102,8 +102,9 @@ export const AddGroup = ({ address, open, setOpen }) => { if (!description) throw new Error('Please provide a description'); const fee = await getFee('CREATE_GROUP'); + await show({ - message: t('core:question.perform_create_group', { + message: t('group:question.create_group', { postProcess: 'capitalize', }), publishFee: fee.fee + ' QORT', @@ -123,7 +124,7 @@ export const AddGroup = ({ address, open, setOpen }) => { if (!response?.error) { setInfoSnack({ type: 'success', - message: t('core:result.success.group_creation', { + message: t('group:result.success.group_creation', { postProcess: 'capitalize', }), }); @@ -132,8 +133,14 @@ export const AddGroup = ({ address, open, setOpen }) => { { ...response, type: 'created-group', - label: `Created group ${name}: awaiting confirmation`, - labelDone: `Created group ${name}: success!`, + label: t('group:result.success.group_creation_name', { + group_name: name, + postProcess: 'capitalize', + }), + labelDone: t('group:result.success.group_creation_label', { + group_name: name, + postProcess: 'capitalize', + }), done: false, }, ...prev, @@ -144,7 +151,11 @@ export const AddGroup = ({ address, open, setOpen }) => { rej({ message: response.error }); }) .catch((error) => { - rej({ message: error.message || 'An error occurred' }); + rej({ + message: + error.message || + t('core:result.error.generic', { postProcess: 'capitalize' }), + }); }); }); } catch (error) { @@ -194,7 +205,7 @@ export const AddGroup = ({ address, open, setOpen }) => { > - Group Management + {t('group:group.management', { postProcess: 'capitalize' })} { }} > { }} /> { }} /> { gap: '5px', }} > - + setName(e.target.value)} /> @@ -303,10 +326,16 @@ export const AddGroup = ({ address, open, setOpen }) => { gap: '5px', }} > - + setDescription(e.target.value)} /> @@ -318,7 +347,13 @@ export const AddGroup = ({ address, open, setOpen }) => { gap: '5px', }} > - + + @@ -341,7 +382,11 @@ export const AddGroup = ({ address, open, setOpen }) => { }} onClick={() => setOpenAdvance((prev) => !prev)} > - Advanced options + + {t('group:advanced_options', { + postProcess: 'capitalize', + })} + {openAdvance ? : } @@ -355,8 +400,9 @@ export const AddGroup = ({ address, open, setOpen }) => { }} > { }} > { }} > @@ -449,7 +552,9 @@ export const AddGroup = ({ address, open, setOpen }) => { color="primary" onClick={handleCreateGroup} > - Create Group + {t('group.action.create', { + postProcess: 'capitalize', + })} diff --git a/src/components/Group/Forum/NewThread.tsx b/src/components/Group/Forum/NewThread.tsx index f83aed9..6f0c466 100644 --- a/src/components/Group/Forum/NewThread.tsx +++ b/src/components/Group/Forum/NewThread.tsx @@ -183,19 +183,19 @@ export const NewThread = ({ const missingFields: string[] = []; if (!isMessage && !threadTitle) { - errorMsg = t('group:provide_thread', { + errorMsg = t('group:question.provide_thread', { postProcess: 'capitalize', }); } if (!name) { - errorMsg = t('group:result.cannot.access_name', { + errorMsg = t('group:result.error.access_name', { postProcess: 'capitalize', }); } if (!groupInfo) { - errorMsg = t('group:result.cannot.group_info', { + errorMsg = t('group:result.error.group_info', { postProcess: 'capitalize', }); }