diff --git a/src/components/RegisterName.tsx b/src/components/RegisterName.tsx
index adb8198..f11e9ee 100644
--- a/src/components/RegisterName.tsx
+++ b/src/components/RegisterName.tsx
@@ -25,6 +25,7 @@ import CheckIcon from '@mui/icons-material/Check';
import ErrorIcon from '@mui/icons-material/Error';
import { useSetAtom } from 'jotai';
import { txListAtom } from '../atoms/global';
+import { useTranslation } from 'react-i18next';
enum Availability {
NULL = 'null',
@@ -50,6 +51,7 @@ export const RegisterName = ({
);
const [nameFee, setNameFee] = useState(null);
const theme = useTheme();
+ const { t } = useTranslation(['core', 'auth', 'group']);
const checkIfNameExisits = async (name) => {
if (!name?.trim()) {
setIsNameAvailable(Availability.NULL);
@@ -110,12 +112,24 @@ export const RegisterName = ({
const registerName = async () => {
try {
- if (!userInfo?.address) throw new Error('Your address was not found');
- if (!registerNameValue) throw new Error('Enter a name');
+ if (!userInfo?.address)
+ throw new Error(
+ t('core:message.error.address_not_found', {
+ postProcess: 'capitalize',
+ })
+ );
+ if (!registerNameValue)
+ throw new Error(
+ t('core:action.enter_name', {
+ postProcess: 'capitalize',
+ })
+ );
const fee = await getFee('REGISTER_NAME');
await show({
- message: 'Would you like to register this name?',
+ message: t('group:question.register_name', {
+ postProcess: 'capitalize',
+ }),
publishFee: fee.fee + ' QORT',
});
setIsLoadingRegisterName(true);
@@ -130,8 +144,9 @@ export const RegisterName = ({
setIsLoadingRegisterName(false);
setInfoSnack({
type: 'success',
- message:
- 'Successfully registered. It may take a couple of minutes for the changes to propagate',
+ message: t('group:message.success.registered_name', {
+ postProcess: 'capitalize',
+ }),
});
setIsOpen(false);
setRegisterNameValue('');
@@ -140,8 +155,15 @@ export const RegisterName = ({
{
...response,
type: 'register-name',
- label: `Registered name: awaiting confirmation. This may take a couple minutes.`,
- labelDone: `Registered name: success!`,
+ label: t('group:message.success.registered_name_label', {
+ postProcess: 'capitalize',
+ }),
+ labelDone: t(
+ 'group:message.success.registered_name_success',
+ {
+ postProcess: 'capitalize',
+ }
+ ),
done: false,
},
...prev.filter((item) => !item.done),
@@ -158,7 +180,9 @@ export const RegisterName = ({
.catch((error) => {
setInfoSnack({
type: 'error',
- message: error.message || 'An error occurred',
+ message:
+ error.message ||
+ t('core:message.error.generic', { postProcess: 'capitalize' }),
});
setOpenSnack(true);
rej(error);
@@ -199,7 +223,9 @@ export const RegisterName = ({
width: '400px',
}}
>
- // TODO: translate
+
+
- Your balance is {balance ?? 0} QORT. A name registration
- requires a {nameFee} QORT fee
+ {t('core:message.generic.name_registration', {
+ balance: balance ?? 0,
+ fee: { nameFee },
+ postProcess: 'capitalize',
+ })}
>
)}
+
+
{isNameAvailable === Availability.AVAILABLE && (
- {registerNameValue} is available
+
+ {t('core:message.generic.name_available', {
+ name: registerNameValue,
+ postProcess: 'capitalize',
+ })}
+
)}
+
{isNameAvailable === Availability.NOT_AVAILABLE && (
- {registerNameValue} is unavailable
+
+ {t('core:message.generic.name_unavailable', {
+ name: registerNameValue,
+ postProcess: 'capitalize',
+ })}
+
)}
+
{isNameAvailable === Availability.LOADING && (
- Checking if name already existis
+
+
+ {t('core:message.generic.name_checking', {
+ postProcess: 'capitalize',
+ })}
+
)}
+
+
- Benefits of a name
+ {t('core:message.generic.name_benefits', {
+ postProcess: 'capitalize',
+ })}
+
-
+
@@ -307,7 +365,11 @@ export const RegisterName = ({
}}
/>
-
+
@@ -322,7 +384,7 @@ export const RegisterName = ({
setRegisterNameValue('');
}}
>
- Close
+ {t('core:action.close', { postProcess: 'capitalize' })}
diff --git a/src/i18n/locales/en/core.json b/src/i18n/locales/en/core.json
index 2b0d173..b33a4bf 100644
--- a/src/i18n/locales/en/core.json
+++ b/src/i18n/locales/en/core.json
@@ -13,9 +13,11 @@
"continue": "continue",
"continue_logout": "continue to logout",
"create_thread": "create thread",
+ "choose_name": "choose a name",
"decline": "decline",
"decrypt": "decrypt",
"edit": "edit",
+ "enter_name": "enter a name",
"export": "export",
"import": "import",
"invite": "invite",
@@ -30,6 +32,7 @@
"post": "post",
"post_message": "post message",
"publish": "publish",
+ "register_name": "register name",
"remove": "remove",
"save": "save",
"start_minting": "start minting"
@@ -67,6 +70,7 @@
"message_us": "please message us on Telegram or Discord if you need 4 QORT to start chatting without any limitations",
"message": {
"error": {
+ "address_not_found": "your address was not found",
"generic": "an error occurred",
"incorrect_password": "incorrect password",
"minting_account_add": "unable to add minting account",
@@ -74,6 +78,15 @@
"missing_field": "missing: {{ field }}",
"save_qdn": "unable to save to QDN"
},
+ "generic": {
+ "name_available": "{{ name }} is available",
+ "name_benefits": "benefits of a name",
+ "name_checking": "checking if name already exists",
+ "name_registration": "your balance is {{ balance }} QORT. A name registration requires a {{ fee }} QORT fee",
+ "name_unavailable": "{{ name }} is unavailable",
+ "publish_data": "publish data to Qortal: anything from apps to videos. Fully decentralized!",
+ "secure_ownership": "secure ownership of data published by your name. You can even sell your name, along with your data to a third party."
+ },
"question": {
"new_user": "are you a new user?"
},
diff --git a/src/i18n/locales/en/group.json b/src/i18n/locales/en/group.json
index f8a7d41..7a8cc23 100644
--- a/src/i18n/locales/en/group.json
+++ b/src/i18n/locales/en/group.json
@@ -118,6 +118,9 @@
"invitation_request": "accepted join request: awaiting confirmation",
"loading_threads": "loading threads... please wait.",
"post_creation": "successfully created post. It may take some time for the publish to propagate",
+ "registered_name": "successfully registered. It may take a couple of minutes for the changes to propagate",
+ "registered_name_label": "registered name: awaiting confirmation. This may take a couple minutes.",
+ "registered_name_success": "registered name: success!",
"rewardshare_add": "add rewardshare: awaiting confirmation",
"rewardshare_add_label": "add rewardshare: success!",
"rewardshare_creation": "confirming creation of rewardshare on chain. Please be patient, this could take up to 90 seconds.",
@@ -131,7 +134,8 @@
},
"question": {
"perform_transaction": "would you like to perform a {{action}} transaction?",
- "provide_thread": "please provide a thread title"
+ "provide_thread": "please provide a thread title",
+ "register_name": "would you like to register this name?"
},
"thread_posts": "new thread posts"
}