diff --git a/src/components/Chat/ChatGroup.tsx b/src/components/Chat/ChatGroup.tsx
index e7df961..b88b4e7 100644
--- a/src/components/Chat/ChatGroup.tsx
+++ b/src/components/Chat/ChatGroup.tsx
@@ -827,23 +827,33 @@ export const ChatGroup = ({
if (replyMessage?.chatReference) {
repliedTo = replyMessage?.chatReference;
}
- let chatReference = onEditMessage?.signature;
+
+ const chatReference = onEditMessage?.signature;
const publicData = isPrivate
? {}
: {
isEdited: chatReference ? true : false,
};
- const imagesToPublish = [];
+
+ interface ImageToPublish {
+ service: string;
+ identifier: string;
+ name: string;
+ base64: string;
+ }
+
+ const imagesToPublish: ImageToPublish[] = [];
const deleteImage =
onEditMessage && isDeleteImage && messageHasImage(onEditMessage);
if (deleteImage) {
const fee = await getFee('ARBITRARY');
- // TODO translate
await show({
publishFee: fee.fee + ' QORT',
- message: 'Would you like to delete your previous chat image?',
+ message: t('core:question.delete_chat_image', {
+ postProcess: 'capitalizeFirst',
+ }),
});
// TODO magic string
@@ -853,6 +863,7 @@ export const ChatGroup = ({
service: onEditMessage?.images[0]?.service,
});
}
+
if (chatImagesToSave?.length > 0) {
const imageToSave = chatImagesToSave[0];
@@ -877,7 +888,12 @@ export const ChatGroup = ({
240000,
true
);
- if (res !== true) throw new Error('Unable to publish images');
+ if (res !== true)
+ throw new Error(
+ t('core:message.error.unable_publish_image', {
+ postProcess: 'capitalizeFirst',
+ })
+ );
}
const images =
@@ -916,7 +932,6 @@ export const ChatGroup = ({
isPrivate === false
? JSON.stringify(objectMessage)
: await encryptChatMessage(message64, secretKeyObject);
- // const res = await sendChatGroup({groupId: selectedGroup,messageText: encryptSingle})
const sendMessageFunc = async () => {
return await sendChatGroup({
@@ -1033,13 +1048,19 @@ export const ChatGroup = ({
try {
if (isSending) return;
if (+balance < 4)
- throw new Error('You need at least 4 QORT to send a message');
- pauseAllQueues();
+ // TODO magic number
+ throw new Error(
+ t('group:message.error.qortals_required', {
+ quantity: 4,
+ postProcess: 'capitalizeFirst',
+ })
+ );
+ pauseAllQueues();
setIsSending(true);
+
const message = '';
const secretKeyObject = await getSecretKey(false, true);
-
const otherData = {
specialId: uid.rnd(),
type: 'reaction',
@@ -1060,8 +1081,6 @@ export const ChatGroup = ({
secretKeyObject,
reactiontypeNumber
);
- // const res = await sendChatGroup({groupId: selectedGroup,messageText: encryptSingle})
-
const sendMessageFunc = async () => {
return await sendChatGroup({
groupId: selectedGroup,
@@ -1113,7 +1132,9 @@ export const ChatGroup = ({
) {
setInfoSnack({
type: 'error',
- message: 'This message already has an image',
+ message: t('core:message.generic.message_with_image', {
+ postProcess: 'capitalizeFirst',
+ }),
});
setOpenSnack(true);
return;
@@ -1122,6 +1143,7 @@ export const ChatGroup = ({
},
[chatImagesToSave, onEditMessage?.images, isDeleteImage]
);
+
return (
{(!!secretKey || isPrivate === false) && (
{!isDeleteImage &&
@@ -1201,19 +1223,20 @@ export const ChatGroup = ({
+
setIsDeleteImage(true)}
@@ -1243,12 +1266,13 @@ export const ChatGroup = ({
))}
+
{chatImagesToSave.map((imgBase64, index) => (
@@ -1261,6 +1285,7 @@ export const ChatGroup = ({
borderRadius: '3px',
}}
/>
+
@@ -1295,6 +1320,7 @@ export const ChatGroup = ({
))}
+
{replyMessage && (
)}
+
{onEditMessage && (
- 4000 ? theme.palette.other.danger : 'unset',
}}
- >{`Your message size is of ${messageSize} bytes out of a maximum of 4000`}
+ >
+ {t('core:message.error.message_size', {
+ maximum: 4000,
+ size: messageSize,
+ postProcess: 'capitalizeFirst',
+ })}
+
)}
@@ -1421,6 +1454,7 @@ export const ChatGroup = ({
)}
+
{isOpenQManager !== null && (
@@ -1493,7 +1527,7 @@ export const ChatGroup = ({
diff --git a/src/components/Chat/ChatList.tsx b/src/components/Chat/ChatList.tsx
index ebacf06..68ac145 100644
--- a/src/components/Chat/ChatList.tsx
+++ b/src/components/Chat/ChatList.tsx
@@ -5,6 +5,7 @@ import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
import { Box, Button, Typography, useTheme } from '@mui/material';
import { ChatOptions } from './ChatOptions';
import ErrorBoundary from '../../common/ErrorBoundary';
+import { useTranslation } from 'react-i18next';
export const ChatList = ({
initialMessages,
@@ -180,6 +181,7 @@ export const ChatList = ({
}, []);
const theme = useTheme();
+ const { t } = useTranslation(['auth', 'core', 'group']);
return (
- Error loading message.
+
+ {t('core:message.error.message_loading', {
+ postProcess: 'capitalizeFirst',
+ })}
+
);
}
@@ -363,26 +369,28 @@ export const ChatList = ({
- Error loading content: Invalid Data
+ {t('group.message.generic.invalid_data', {
+ postProcess: 'capitalizeFirst',
+ })}
}
>
@@ -409,9 +417,12 @@ export const ChatList = ({
zIndex: 10,
}}
>
- Scroll to Unread Messages
+ {t('group:action.scroll_unread_messages', {
+ postProcess: 'capitalizeFirst',
+ })}
)}
+
{showScrollDownButton && !showScrollButton && (
)}
diff --git a/src/i18n/locales/en/core.json b/src/i18n/locales/en/core.json
index 92e2dd6..669dd8c 100644
--- a/src/i18n/locales/en/core.json
+++ b/src/i18n/locales/en/core.json
@@ -125,6 +125,7 @@
"generic": "an error occurred",
"invalid_signature": "invalid signature",
"invalid_zip": "invalid zip",
+ "message_loading": "error loading message.",
"message_size": "your message size is of {{ size }} bytes out of a maximum of {{ maximum }}",
"minting_account_add": "unable to add minting account",
"minting_account_remove": "unable to remove minting account",
@@ -138,6 +139,7 @@
"save_qdn": "unable to save to QDN",
"unable_encrypt_app": "unable to encrypt app. App not published'",
"unable_publish_app": "unable to publish app",
+ "unable_publish_image": "unable to publish image",
"unable_rate": "unable to rate"
},
"generic": {
@@ -146,6 +148,7 @@
"devmode_local_node": "please use your local node for dev mode! Logout and use Local node.",
"fee_qort": "fee: {{ message }} QORT",
"foreign_fee": "foreign fee: {{ message }}",
+ "message_with_image": "this message already has an image",
"name_available": "{{ name }} is available",
"name_benefits": "benefits of a name",
"name_checking": "checking if name already exists",
@@ -218,6 +221,7 @@
"q_sandbox": "q-Sandbox"
},
"question": {
+ "delete_chat_image": "would you like to delete your previous chat image?",
"perform_transaction": "would you like to perform a {{action}} transaction?",
"provide_thread": "please provide a thread title",
"publish_app": "would you like to publish this app?",
diff --git a/src/i18n/locales/en/group.json b/src/i18n/locales/en/group.json
index 78292c4..ceea5ac 100644
--- a/src/i18n/locales/en/group.json
+++ b/src/i18n/locales/en/group.json
@@ -22,6 +22,8 @@
"remove_admin": "remove as admin",
"remove_minting_account": "remove minting account",
"return_to_thread": "return to threads",
+ "scroll_bottom": "scroll to bottom",
+ "scroll_unread_messages": "scroll to Unread Messages",
"select_group": "select a group",
"visit_q_mintership": "visit Q-Mintership"
},
diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts
index 4607e81..3f71405 100644
--- a/src/qortalRequests/get.ts
+++ b/src/qortalRequests/get.ts
@@ -85,7 +85,7 @@ import { RequestQueueWithPromise } from '../utils/queue/queue';
import utils from '../utils/utils';
import ShortUniqueId from 'short-unique-id';
import { isValidBase64WithDecode } from '../utils/decode';
-
+//TODO translate
const uid = new ShortUniqueId({ length: 6 });
export const requestQueueGetAtAddresses = new RequestQueueWithPromise(10);