From 2fb735c430710d5b36a14cae7d3266e31fd4b556 Mon Sep 17 00:00:00 2001 From: softsimon Date: Sun, 7 Jul 2024 23:01:55 +0900 Subject: [PATCH] adding missing i18n --- .../accelerate-checkout.component.html | 4 +-- .../mempool-error.component.html | 2 ++ .../mempool-error/mempool-error.component.ts | 21 ++++++++++---- frontend/src/locale/messages.xlf | 28 ++++++++++++++++--- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html index fba41f2c3..21488ff52 100644 --- a/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html +++ b/frontend/src/app/components/accelerate-checkout/accelerate-checkout.component.html @@ -354,7 +354,7 @@
- +
@@ -364,7 +364,7 @@ @if (canPayWithBalance || !(canPayWithBitcoin || canPayWithCashapp)) {
-

Your account will be debited no more than {{ cost | number }} sats

+

Your account will be debited no more than {{ cost | number }} sats

diff --git a/frontend/src/app/shared/components/mempool-error/mempool-error.component.html b/frontend/src/app/shared/components/mempool-error/mempool-error.component.html index d461530b0..5ef745d37 100644 --- a/frontend/src/app/shared/components/mempool-error/mempool-error.component.html +++ b/frontend/src/app/shared/components/mempool-error/mempool-error.component.html @@ -5,3 +5,5 @@ } + +Your balance is too low. Please top up your account. diff --git a/frontend/src/app/shared/components/mempool-error/mempool-error.component.ts b/frontend/src/app/shared/components/mempool-error/mempool-error.component.ts index 72e81e1f3..9d3d94274 100644 --- a/frontend/src/app/shared/components/mempool-error/mempool-error.component.ts +++ b/frontend/src/app/shared/components/mempool-error/mempool-error.component.ts @@ -1,5 +1,5 @@ -import { Component, Input, OnInit } from "@angular/core"; -import { DomSanitizer, SafeHtml } from "@angular/platform-browser"; +import { AfterViewInit, Component, Input, OnInit, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core'; +import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; export const MempoolErrors = { 'bad_request': `Your request was not valid. Please try again.`, @@ -16,7 +16,7 @@ export const MempoolErrors = { 'mempool_rejected_raw_tx': `Our mempool rejected this transaction`, 'no_mining_pool_available': `No mining pool available at the moment`, 'not_available': `You current subscription does not allow you to access this feature.`, - 'not_enough_balance': `Your balance is too low. Please top up your account.`, + 'not_enough_balance': ``, 'not_verified': `You must verify your account to use this feature.`, 'recommended_fees_not_available': `Recommended fees are not available right now.`, 'too_many_relatives': `This transaction has too many relatives.`, @@ -42,13 +42,24 @@ export function isMempoolError(error: string) { selector: 'app-mempool-error', templateUrl: './mempool-error.component.html' }) -export class MempoolErrorComponent implements OnInit { +export class MempoolErrorComponent implements OnInit, AfterViewInit { + @ViewChild('lowBalance') lowBalance!: TemplateRef; @Input() error: string; @Input() alertClass = 'alert-danger'; @Input() textOnly = false; errorContent: SafeHtml; - constructor(private sanitizer: DomSanitizer) { } + constructor( + private sanitizer: DomSanitizer, + private viewContainerRef: ViewContainerRef, + ) { } + + ngAfterViewInit(): void { + // Special hack for the i18n string with a href link inside + const view = this.viewContainerRef.createEmbeddedView(this.lowBalance); + const rawHtml = view.rootNodes.map(node => node.outerHTML).join(''); + MempoolErrors['not_enough_balance'] = rawHtml; + } ngOnInit(): void { if (Object.keys(MempoolErrors).includes(this.error)) { diff --git a/frontend/src/locale/messages.xlf b/frontend/src/locale/messages.xlf index cdb6e3269..3492db7e0 100644 --- a/frontend/src/locale/messages.xlf +++ b/frontend/src/locale/messages.xlf @@ -784,6 +784,14 @@ accelerator.payment-to-mempool-space + + Your account will be debited no more than + + src/app/components/accelerate-checkout/accelerate-checkout.component.html + 367 + + accelerator.your-account-will-be-debited + Pay @@ -3850,10 +3858,6 @@ src/app/components/custom-dashboard/custom-dashboard.component.html 8 - - src/app/dashboard/dashboard.component.html - 6 - fees-box.transaction-fees @@ -7193,6 +7197,14 @@ TX Fee Rating is Warning tx-fee-rating.overpaid.warning + + Error: + + src/app/dashboard/dashboard.component.html + 6,7 + + fees-box.transaction-fees + Liquid Federation Holdings @@ -9247,6 +9259,14 @@ Third-party Licenses shared.trademark-policy + + Your balance is too low. Please top up your account. + + src/app/shared/components/mempool-error/mempool-error.component.html + 9 + + accelerator.low-balance + This is a test network. Coins have no value.