refactor: standardize notification message formatting

- Updated notification message arguments to use consistent object syntax for better readability.
- Modified Arabic and English translation files to reflect the new argument format in notification messages.
This commit is contained in:
Abdalhamid Alhamad
2026-01-12 16:28:26 +03:00
parent 21653efc46
commit d3ff755439
3 changed files with 32 additions and 12 deletions

View File

@ -103,11 +103,20 @@ export class TransactionNotificationListener {
const message = isTopUp
? this.i18n.t('app.NOTIFICATION.CHILD_TOP_UP_MESSAGE', {
lang: locale,
args: { amount: amount.toString(), currency, balance: balance.toString() },
args: {
amount: amount.toString(),
currency: currency,
balance: balance.toString(),
},
})
: this.i18n.t('app.NOTIFICATION.CHILD_SPENDING_MESSAGE', {
lang: locale,
args: { amount: amount.toString(), currency, merchant, balance: balance.toString() },
args: {
amount: amount.toString(),
currency: currency,
merchant: merchant,
balance: balance.toString(),
},
});
this.logger.debug(
@ -174,7 +183,13 @@ export class TransactionNotificationListener {
const title = this.i18n.t('app.NOTIFICATION.PARENT_SPENDING_TITLE', { lang: locale });
const message = this.i18n.t('app.NOTIFICATION.PARENT_SPENDING_MESSAGE', {
lang: locale,
args: { childName, amount: amount.toString(), currency, merchant, balance: balance.toString() },
args: {
childName: childName,
amount: amount.toString(),
currency: currency,
merchant: merchant,
balance: balance.toString(),
},
});
await this.notificationFactory.send({
@ -238,7 +253,12 @@ export class TransactionNotificationListener {
const title = this.i18n.t('app.NOTIFICATION.PARENT_TOP_UP_TITLE', { lang: locale });
const message = this.i18n.t('app.NOTIFICATION.PARENT_TOP_UP_MESSAGE', {
lang: locale,
args: { amount: amount.toString(), currency, childName, balance: balance.toString() },
args: {
amount: amount.toString(),
currency: currency,
childName: childName,
balance: balance.toString(),
},
});
await this.notificationFactory.send({

View File

@ -113,13 +113,13 @@
},
"NOTIFICATION": {
"CHILD_TOP_UP_TITLE": "تم شحن البطاقة",
"CHILD_TOP_UP_MESSAGE": "لقد استلمت {{amount}} {{currency}}. الرصيد الإجمالي: {{balance}} {{currency}}",
"CHILD_TOP_UP_MESSAGE": "لقد استلمت {amount} {currency}. الرصيد الإجمالي: {balance} {currency}",
"CHILD_SPENDING_TITLE": "تمت العملية بنجاح",
"CHILD_SPENDING_MESSAGE": "لقد أنفقت {{amount}} {{currency}} في {{merchant}}. الرصيد: {{balance}} {{currency}}",
"CHILD_SPENDING_MESSAGE": "لقد أنفقت {amount} {currency} في {merchant}. الرصيد: {balance} {currency}",
"PARENT_TOP_UP_TITLE": "تأكيد الشحن",
"PARENT_TOP_UP_MESSAGE": "لقد قمت بتحويل {{amount}} {{currency}} إلى {{childName}}. الرصيد: {{balance}} {{currency}}",
"PARENT_TOP_UP_MESSAGE": "لقد قمت بتحويل {amount} {currency} إلى {childName}. الرصيد: {balance} {currency}",
"PARENT_SPENDING_TITLE": "تنبيه إنفاق الطفل",
"PARENT_SPENDING_MESSAGE": "أنفق {{childName}} {{amount}} {{currency}} في {{merchant}}. الرصيد: {{balance}} {{currency}}",
"PARENT_SPENDING_MESSAGE": "أنفق {childName} {amount} {currency} في {merchant}. الرصيد: {balance} {currency}",
"YOUR_CHILD": "طفلك"
}
}

View File

@ -112,13 +112,13 @@
},
"NOTIFICATION": {
"CHILD_TOP_UP_TITLE": "Card Topped Up",
"CHILD_TOP_UP_MESSAGE": "You received {{amount}} {{currency}}. Total balance: {{balance}} {{currency}}",
"CHILD_TOP_UP_MESSAGE": "You received {amount} {currency}. Total balance: {balance} {currency}",
"CHILD_SPENDING_TITLE": "Purchase Successful",
"CHILD_SPENDING_MESSAGE": "You spent {{amount}} {{currency}} at {{merchant}}. Balance: {{balance}} {{currency}}",
"CHILD_SPENDING_MESSAGE": "You spent {amount} {currency} at {merchant}. Balance: {balance} {currency}",
"PARENT_TOP_UP_TITLE": "Top-Up Confirmation",
"PARENT_TOP_UP_MESSAGE": "You transferred {{amount}} {{currency}} to {{childName}}. Balance: {{balance}} {{currency}}",
"PARENT_TOP_UP_MESSAGE": "You transferred {amount} {currency} to {childName}. Balance: {balance} {currency}",
"PARENT_SPENDING_TITLE": "Child Spending Alert",
"PARENT_SPENDING_MESSAGE": "{{childName}} spent {{amount}} {{currency}} at {{merchant}}. Balance: {{balance}} {{currency}}",
"PARENT_SPENDING_MESSAGE": "{childName} spent {amount} {currency} at {merchant}. Balance: {balance} {currency}",
"YOUR_CHILD": "Your child"
}
}