diff --git a/src/app/core/pipes/frequency.pipe.ts b/src/app/core/pipes/frequency.pipe.ts index e924f8bcfa1..44532734173 100644 --- a/src/app/core/pipes/frequency.pipe.ts +++ b/src/app/core/pipes/frequency.pipe.ts @@ -1,4 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; /** * The frequency pipe converts a string of special interval format to the corresponding display string @@ -6,9 +7,12 @@ import { Pipe, PipeTransform } from '@angular/core'; */ @Pipe({ name: 'ishFrequency' }) export class FrequencyPipe implements PipeTransform { + constructor(private translate: TranslateService) {} + transform(interval: string): string { let period = interval.slice(-1).toUpperCase(); let duration = parseInt(interval.slice(1, -1), 10); + // convert days to weeks if possible since the API only returns daily, monthly or yearly intervals if (period === 'D' && duration % 7 === 0) { period = 'W'; @@ -17,13 +21,13 @@ export class FrequencyPipe implements PipeTransform { switch (period) { case 'D': - return `${duration} Day(s)`; + return this.translate.instant('order.recurrence.period.days', { 0: duration }); case 'W': - return `${duration} Week(s)`; + return this.translate.instant('order.recurrence.period.weeks', { 0: duration }); case 'M': - return `${duration} Month(s)`; + return this.translate.instant('order.recurrence.period.months', { 0: duration }); case 'Y': - return `${duration} Year(s)`; + return this.translate.instant('order.recurrence.period.years', { 0: duration }); default: return interval; } diff --git a/src/assets/i18n/de_DE.json b/src/assets/i18n/de_DE.json index d28df9fb41c..6a3f28799e8 100644 --- a/src/assets/i18n/de_DE.json +++ b/src/assets/i18n/de_DE.json @@ -938,10 +938,10 @@ "order.recurrence.form.info.text": "Bestellungen", "order.recurrence.heading": "Recurring order", "order.recurrence.interval.label": "Recur every", - "order.recurrence.period.days": "Tag(e)", - "order.recurrence.period.months": "Monate(e)", - "order.recurrence.period.weeks": "Woche(n)", - "order.recurrence.period.years": "Jahr(e)", + "order.recurrence.period.days": "{{0, plural, one{# Tag} other{# Tage}}}", + "order.recurrence.period.months": "{{0, plural, one{# Monat} other{# Monate}}}", + "order.recurrence.period.weeks": "{{0, plural, one{# Woche} other{# Wochen}}}", + "order.recurrence.period.years": "{{0, plural, one{# Jahr} other{# Jahre}}}", "order.recurrence.repetitions.label": "Bis", "order.recurrence.start.label": "Beginne am", "order.tracking.error": "Leider konnte keine Bestellung mit Ihren Daten gefunden werden.", diff --git a/src/assets/i18n/en_US.json b/src/assets/i18n/en_US.json index edf0423bf29..29682b1574f 100644 --- a/src/assets/i18n/en_US.json +++ b/src/assets/i18n/en_US.json @@ -398,14 +398,14 @@ "account.quotes.widget.view_all_quotes.link": "View all quotes", "account.recurring_orders.heading": "Recurring orders", "account.recurring_orders.navigation.link": "Recurring orders", + "account.recurring_orders.subtitle": "Your most recent recurring order appears first. Please allow up to 5 minutes for new orders to appear below.", + "account.recurring_orders.table.date_of_order": "Creation date", "account.recurring_orders.table.id_of_order": "No.", "account.recurring_orders.table.id_of_order.aria_label": "Navigate to order details", - "account.recurring_orders.table.date_of_order": "Creation date", "account.recurring_orders.table.last_order_date": "Last order", "account.recurring_orders.table.next_order_date": "Next order", "account.recurring_orders.table.order_frequency": "Recur every", "account.recurring_orders.table.order_total": "Total", - "account.recurring_orders.subtitle": "Your most recent recurring order appears first. Please allow up to 5 minutes for new orders to appear below.", "account.register.address.headding": "Address", "account.register.address.message": "To save time when placing an order, please provide your primary invoice or shipping address below. We will store this information so you won’t have to enter it again.", "account.register.company_information.heading": "Company information", @@ -946,10 +946,10 @@ "order.recurrence.form.info.text": "orders", "order.recurrence.heading": "Recurring order", "order.recurrence.interval.label": "Recur every", - "order.recurrence.period.days": "Day(s)", - "order.recurrence.period.months": "Month(s)", - "order.recurrence.period.weeks": "Week(s)", - "order.recurrence.period.years": "Year(s)", + "order.recurrence.period.days": "{{0, plural, one{# Day} other{# Days}}}", + "order.recurrence.period.months": "{{0, plural, one{# Month} other{# Months}}}", + "order.recurrence.period.weeks": "{{0, plural, one{# Week} other{# Weeks}}}", + "order.recurrence.period.years": "{{0, plural, one{# Year} other{# Years}}}", "order.recurrence.repetitions.label": "Until", "order.recurrence.start.label": "Start from", "order.tracking.error": "Unfortunately, we could not locate an order with the information you provided.", diff --git a/src/assets/i18n/fr_FR.json b/src/assets/i18n/fr_FR.json index d36cccc74a9..c25588ccec7 100644 --- a/src/assets/i18n/fr_FR.json +++ b/src/assets/i18n/fr_FR.json @@ -938,10 +938,10 @@ "order.recurrence.form.info.text": "orders", "order.recurrence.heading": "Recurring order", "order.recurrence.interval.label": "Recur every", - "order.recurrence.period.days": "Day(s)", - "order.recurrence.period.months": "Month(s)", - "order.recurrence.period.weeks": "Week(s)", - "order.recurrence.period.years": "Year(s)", + "order.recurrence.period.days": "{{0, plural, one{# Day} other{# Days}}}", + "order.recurrence.period.months": "{{0, plural, one{# Month} other{# Months}}}", + "order.recurrence.period.weeks": "{{0, plural, one{# Week} other{# Weeks}}}", + "order.recurrence.period.years": "{{0, plural, one{# Year} other{# Years}}}", "order.recurrence.repetitions.label": "Until", "order.recurrence.start.label": "Start from", "order.tracking.error": "Malheureusement, nous n’avons pas pu localiser une commande avec les informations que vous avez fournies.",