diff --git a/bot/ordersActions.ts b/bot/ordersActions.ts index 66dcbdac..cea4164e 100644 --- a/bot/ordersActions.ts +++ b/bot/ordersActions.ts @@ -248,7 +248,14 @@ const buildDescription = ( const ageInDays = getUserAge(user); - const firstLine = getOrderTitleMessage(user, type, i18n); + const firstLine = getOrderTitleMessage( + user, + type, + amount, + fiatCode, + priceFromAPI, + i18n, + ); let description: string = `${firstLine}\n`; description += i18n.t('for') + ` ${currencyString}\n`; @@ -269,19 +276,30 @@ const buildDescription = ( const getOrderTitleMessage = ( user: UserDocument, type: string, + orderAmount: number, + fiatCode: string, + priceFromAPI: boolean, i18n: I18nContext, ) => { const isSell = type === 'sell'; + // Fixed-price orders show the sats volume in the title; market-price orders + // don't, since the sats amount is not known until the order is taken. + const amount = priceFromAPI ? '' : numberFormat(fiatCode, orderAmount); - // Guard Clause: The user DOES want to show their name, we resolve and leave. + let title: string; if (user.show_username) { - return isSell - ? i18n.t('showusername_selling_sats', { username: user.username }) - : i18n.t('showusername_buying_sats', { username: user.username }); + title = isSell + ? i18n.t('showusername_selling_sats', { username: user.username, amount }) + : i18n.t('showusername_buying_sats', { username: user.username, amount }); + } else { + title = isSell + ? i18n.t('selling_sats', { amount }) + : i18n.t('buying_sats', { amount }); } - // The user DOES NOT want to show their name. - return isSell ? i18n.t('selling_sats') : i18n.t('buying_sats'); + // Collapse any double spaces left when amount is empty (market orders) so the + // result is clean regardless of where translators place the ${amount} slot. + return title.replace(/\s+/g, ' ').trim(); }; const getOrder = async ( diff --git a/locales/de.yaml b/locales/de.yaml index 36dfbaba..39064529 100644 --- a/locales/de.yaml +++ b/locales/de.yaml @@ -452,11 +452,11 @@ pending_payment_failed_to_admin: | Zahlungsversuche: ${attempts} selling: Verkaufe buying: Kaufe -selling_sats: Verkaufe Sats -buying_sats: Kaufe Sats +selling_sats: 'Verkaufe ${amount} Sats' +buying_sats: 'Kaufe ${amount} Sats' receive_payment: Zahlung erhalten -showusername_buying_sats: '@${username} kauft Sats' -showusername_selling_sats: '@${username} verkauft Sats' +showusername_buying_sats: '@${username} kauft ${amount} Sats' +showusername_selling_sats: '@${username} verkauft ${amount} Sats' pay: Bezahlen is: ist trading_volume: 'Handelsvolumen: ${Volumen} Sats' diff --git a/locales/en.yaml b/locales/en.yaml index 83b202c2..5ce73e97 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -459,10 +459,10 @@ pending_payment_failed_to_admin: | Payment attempts: ${attempts} selling: Selling buying: Buying -selling_sats: Selling sats -buying_sats: Buying sats -showusername_selling_sats: '@${username} is selling sats' -showusername_buying_sats: '@${username} is buying sats' +selling_sats: 'Selling ${amount} sats' +buying_sats: 'Buying ${amount} sats' +showusername_selling_sats: '@${username} is selling ${amount} sats' +showusername_buying_sats: '@${username} is buying ${amount} sats' receive_payment: Receive payment pay: Pay is: is diff --git a/locales/es.yaml b/locales/es.yaml index e54b73a3..5d1dc4e3 100644 --- a/locales/es.yaml +++ b/locales/es.yaml @@ -454,10 +454,10 @@ pending_payment_failed_to_admin: | Intento de pago: ${attempts} selling: Vendiendo buying: Comprando -selling_sats: Vendiendo sats -buying_sats: Comprando sats -showusername_buying_sats: '@${username} está comprando sats' -showusername_selling_sats: '@${username} está vendiendo sats' +selling_sats: 'Vendiendo ${amount} sats' +buying_sats: 'Comprando ${amount} sats' +showusername_buying_sats: '@${username} está comprando ${amount} sats' +showusername_selling_sats: '@${username} está vendiendo ${amount} sats' receive_payment: Recibo pago pay: Pago is: está diff --git a/locales/fa.yaml b/locales/fa.yaml index 002f6e87..7b0ac915 100644 --- a/locales/fa.yaml +++ b/locales/fa.yaml @@ -535,14 +535,14 @@ pending_payment_failed_to_admin: | تعداد تلاش‌های پرداخت: ${attempts} selling: فروختن buying: خریدن -selling_sats: فروش ساتوشی -buying_sats: خرید ساتوشی +selling_sats: 'فروش ${amount} ساتوشی' +buying_sats: 'خرید ${amount} ساتوشی' receive_payment: دریافت وجه pay: پرداخت is: هست trading_volume: 'حجم معاملات: ${volume} sat' -showusername_buying_sats: '@${username} در حال خرید ساتوشی است' -showusername_selling_sats: '@${username} در حال فروش ساتوشی است' +showusername_buying_sats: '@${username} در حال خرید ${amount} ساتوشی است' +showusername_selling_sats: '@${username} در حال فروش ${amount} ساتوشی است' satoshis: ساتوشی‌ها by: توسط rate: نرخ diff --git a/locales/fr.yaml b/locales/fr.yaml index a6decd9b..2b41366e 100644 --- a/locales/fr.yaml +++ b/locales/fr.yaml @@ -451,11 +451,11 @@ pending_payment_failed_to_admin: | Tentatives de paiement : ${attempts} selling: Vente buying: Achat -selling_sats: Vente de sats -buying_sats: Achat de sats +selling_sats: 'Vente de ${amount} sats' +buying_sats: 'Achat de ${amount} sats' receive_payment: Réception du paiement -showusername_buying_sats: "@${username} achète des sats" -showusername_selling_sats: "@${username} vend des sats" +showusername_buying_sats: "@${username} achète ${amount} sats" +showusername_selling_sats: "@${username} vend ${amount} sats" pay: Payer is: est trading_volume: 'Volume de transactions : ${volume} sats' diff --git a/locales/it.yaml b/locales/it.yaml index 0e47fe04..53f365eb 100644 --- a/locales/it.yaml +++ b/locales/it.yaml @@ -449,14 +449,14 @@ pending_payment_failed_to_admin: | Payment attempts: ${attempts} selling: Vendita buying: Acquisto -selling_sats: Vendita sats -buying_sats: Acquisto sats +selling_sats: 'Vendita ${amount} sats' +buying_sats: 'Acquisto ${amount} sats' receive_payment: Ricezione del pagamento pay: Paga is: è trading_volume: 'Volume scambio: ${volume} sats' -showusername_buying_sats: '@${username} sta comprando sats' -showusername_selling_sats: '@${username} sta vendendo sats' +showusername_buying_sats: '@${username} sta comprando ${amount} sats' +showusername_selling_sats: '@${username} sta vendendo ${amount} sats' satoshis: satoshi by: da rate: Valutazione diff --git a/locales/ko.yaml b/locales/ko.yaml index 03c9dafe..f09fd94a 100644 --- a/locales/ko.yaml +++ b/locales/ko.yaml @@ -449,14 +449,14 @@ pending_payment_failed_to_admin: | selling: 팝니다 buying: 삽니다 -selling_sats: sats 판매 -buying_sats: sats 구매 +selling_sats: '${amount} sats 판매' +buying_sats: '${amount} sats 구매' receive_payment: 입금 pay: 결제 is: is trading_volume: '거래량: ${volume} sats' -showusername_buying_sats: '@${username} 님이 sats를 구매합니다' -showusername_selling_sats: '@${username} 님이 sats를 판매합니다' +showusername_buying_sats: '@${username} 님이 ${amount} sats를 구매합니다' +showusername_selling_sats: '@${username} 님이 ${amount} sats를 판매합니다' satoshis: 사토시 by: 방법 - rate: 환율 diff --git a/locales/pt.yaml b/locales/pt.yaml index 991d31e6..dd402d6f 100644 --- a/locales/pt.yaml +++ b/locales/pt.yaml @@ -451,12 +451,12 @@ pending_payment_failed_to_admin: | Tentativas de pagamento: ${attempts} selling: Vendendo buying: Comprando -selling_sats: Vendendo sats -buying_sats: Comprando sats +selling_sats: 'Vendendo ${amount} sats' +buying_sats: 'Comprando ${amount} sats' receive_payment: Receber pagamento pay: Pagar -showusername_buying_sats: '@${username} está comprando sats' -showusername_selling_sats: '@${username} está vendendo sats' +showusername_buying_sats: '@${username} está comprando ${amount} sats' +showusername_selling_sats: '@${username} está vendendo ${amount} sats' is: é trading_volume: 'Volume de negócios: ${volume} sats' satoshis: satoshis diff --git a/locales/ru.yaml b/locales/ru.yaml index 15849091..eadb98de 100644 --- a/locales/ru.yaml +++ b/locales/ru.yaml @@ -452,11 +452,11 @@ pending_payment_failed_to_admin: | Попытка оплаты: ${attempts} selling: Продаю buying: Покупаю -selling_sats: Продажа сат -buying_sats: Покупка сат +selling_sats: 'Продажа ${amount} сат' +buying_sats: 'Покупка ${amount} сат' receive_payment: Расчет -showusername_buying_sats: '@${username} покупает саты' -showusername_selling_sats: '@${username} продает саты' +showusername_buying_sats: '@${username} покупает ${amount} саты' +showusername_selling_sats: '@${username} продает ${amount} саты' pay: Расчет is: Я trading_volume: 'Обьем торгов: ${volume} сат' diff --git a/locales/uk.yaml b/locales/uk.yaml index bd9a5707..ac3db7a9 100644 --- a/locales/uk.yaml +++ b/locales/uk.yaml @@ -449,14 +449,14 @@ pending_payment_failed_to_admin: | Спроб оплати: ${attempts} selling: Продаю buying: Купую -selling_sats: Продаж сатоші -buying_sats: Купівля сатоші +selling_sats: 'Продаж ${amount} сатоші' +buying_sats: 'Купівля ${amount} сатоші' receive_payment: Розрахунок pay: Оплата is: є trading_volume: 'Обсяг торгів: ${volume} сат' -showusername_buying_sats: '@${username} купує сатоші' -showusername_selling_sats: '@${username} продає сатоші' +showusername_buying_sats: '@${username} купує ${amount} сатоші' +showusername_selling_sats: '@${username} продає ${amount} сатоші' satoshis: сатоші by: за допомогою rate: Kурс