From 1163bfd88a187ab36e53da3dd87014fb5b32989c Mon Sep 17 00:00:00 2001 From: sdarbinyan Date: Sat, 25 Jul 2026 23:54:08 +0400 Subject: [PATCH] fix(storefront): replace hardcoded strings with i18n, neutral empty-state wording MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Route aria-label/alt/title strings (rating, discount, carousel arrows, hero slides, dialog close, toast dismiss, QR code, bank payment iframe, guest checkout fallback) through the translate pipe/service instead of literal English. - Drop the "Oops!"/"Упс!" apology framing from category/subcategory empty states (en/ru/hy) - zero results is not an error. --- .../product-card/product-card.component.html | 4 ++-- .../telegram-login/telegram-login.component.html | 2 +- .../floating-notifications.component.html | 2 +- .../floating-notifications.component.ts | 2 ++ src/app/i18n/en.ts | 15 +++++++++++++-- src/app/i18n/hy.ts | 13 ++++++++++++- src/app/i18n/ru.ts | 15 +++++++++++++-- src/app/i18n/translations.ts | 11 +++++++++++ src/app/pages/cart/cart.component.html | 2 +- src/app/pages/cart/cart.component.ts | 2 +- src/app/shared/ui/dialog/dialog.component.html | 2 +- src/app/shared/ui/dialog/dialog.component.ts | 2 ++ src/app/widgets/ui/hero-widget.component.ts | 7 ++++--- .../ui/product-carousel-widget.component.ts | 7 ++++--- 14 files changed, 68 insertions(+), 18 deletions(-) diff --git a/src/app/components/product-card/product-card.component.html b/src/app/components/product-card/product-card.component.html index 804a856..4fe7075 100644 --- a/src/app/components/product-card/product-card.component.html +++ b/src/app/components/product-card/product-card.component.html @@ -3,7 +3,7 @@
@if (showDiscountBadge && item.discount > 0) { -
-{{ item.discount }}%
+
-{{ item.discount }}%
} @if (showStock && item.remainings) { {{ stockLabelKey(item.remainings) | translate }} @@ -43,7 +43,7 @@ } @if (showRating) { -
+
{{ item.rating | number:'1.1-1' }} ({{ item.callbacks?.length || item.comments?.length || 0 }})
diff --git a/src/app/components/telegram-login/telegram-login.component.html b/src/app/components/telegram-login/telegram-login.component.html index 32bd6a8..7c4f357 100644 --- a/src/app/components/telegram-login/telegram-login.component.html +++ b/src/app/components/telegram-login/telegram-login.component.html @@ -43,7 +43,7 @@ @case ('ready') {
QR Code diff --git a/src/app/features/website/user-experience/components/floating-notifications/floating-notifications.component.html b/src/app/features/website/user-experience/components/floating-notifications/floating-notifications.component.html index a4f6982..899418e 100644 --- a/src/app/features/website/user-experience/components/floating-notifications/floating-notifications.component.html +++ b/src/app/features/website/user-experience/components/floating-notifications/floating-notifications.component.html @@ -3,7 +3,7 @@ @for (note of notifications(); track note.id) {

{{ note.message }}

- +
} diff --git a/src/app/features/website/user-experience/components/floating-notifications/floating-notifications.component.ts b/src/app/features/website/user-experience/components/floating-notifications/floating-notifications.component.ts index 24bc528..822de70 100644 --- a/src/app/features/website/user-experience/components/floating-notifications/floating-notifications.component.ts +++ b/src/app/features/website/user-experience/components/floating-notifications/floating-notifications.component.ts @@ -1,9 +1,11 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { UserNotificationService } from '../../services/user-notification.service'; +import { TranslatePipe } from '../../../../../i18n/translate.pipe'; @Component({ selector: 'app-floating-notifications', standalone: true, + imports: [TranslatePipe], templateUrl: './floating-notifications.component.html', styleUrls: ['./floating-notifications.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush diff --git a/src/app/i18n/en.ts b/src/app/i18n/en.ts index 97865e6..31784f6 100644 --- a/src/app/i18n/en.ts +++ b/src/app/i18n/en.ts @@ -161,7 +161,7 @@ export const en: Translations = { addToCart: 'Add to cart', loadingMore: 'Loading...', allLoaded: 'All products loaded', - emptyTitle: 'Oops! Nothing here yet', + emptyTitle: 'Nothing here yet', emptyDesc: 'There are no products in this category yet, but they will appear soon', goHome: 'Go home', loading: 'Loading products...', @@ -339,7 +339,7 @@ export const en: Translations = { subcategories: { loading: 'Loading subcategories...', retry: 'Try again', - emptyTitle: 'Oops! No subcategories yet', + emptyTitle: 'No subcategories yet', emptyDesc: 'There are no subcategories in this section yet, but they will appear soon', goHome: 'Go home', itemsInCategory: 'Items in this category', @@ -1086,6 +1086,17 @@ export const en: Translations = { remove: 'Remove', errorTitle: 'Something went wrong', errorDescription: 'We could not load this data. Please try again.', + ratingLabel: 'Rating {{value}}', + discountLabel: 'Discount {{value}}%', + slideLabel: 'Slide {{value}}', + slidesLabel: 'Slides', + previousProducts: 'Previous products', + nextProducts: 'Next products', + closeDialog: 'Close dialog', + dismiss: 'Dismiss', + qrCode: 'QR Code', + bankCardPayment: 'Bank card payment', + guest: 'Guest', }, location: { allRegions: 'All regions', diff --git a/src/app/i18n/hy.ts b/src/app/i18n/hy.ts index f128f1a..6d31d81 100644 --- a/src/app/i18n/hy.ts +++ b/src/app/i18n/hy.ts @@ -161,7 +161,7 @@ export const hy: Translations = { addToCart: 'Ավելացնել զամբյուղ', loadingMore: 'Բեռնում...', allLoaded: 'Բոլոր ապրանքները բեռնված են', - emptyTitle: 'Վա՜յ, այստեղ դեռ դատարկ է', + emptyTitle: 'Այստեղ դեռ դատարկ է', emptyDesc: 'Այս կատեգորիայում դեռ ապրանքներ չկան', goHome: 'Գլխավոր', loading: 'Ապրանքների բեռնում...', @@ -1086,6 +1086,17 @@ export const hy: Translations = { remove: 'Հեռացնել', errorTitle: 'Ինչ-որ բան այն չէ', errorDescription: 'Չհաջողվեց բեռնել տվյալները։ Փորձեք կրկին։', + ratingLabel: 'Վարկանիշ {{value}}', + discountLabel: 'Զեղչ {{value}}%', + slideLabel: 'Սլայդ {{value}}', + slidesLabel: 'Սլայդներ', + previousProducts: 'Նախորդ ապրանքները', + nextProducts: 'Հաջորդ ապրանքները', + closeDialog: 'Փակել պատուհանը', + dismiss: 'Փակել', + qrCode: 'QR կոդ', + bankCardPayment: 'Վճարում բանկային քարտով', + guest: 'Հյուր', }, location: { allRegions: 'Բոլոր տարածաշրջանները', diff --git a/src/app/i18n/ru.ts b/src/app/i18n/ru.ts index 6b16636..e8652c0 100644 --- a/src/app/i18n/ru.ts +++ b/src/app/i18n/ru.ts @@ -161,7 +161,7 @@ export const ru: Translations = { addToCart: 'В корзину', loadingMore: 'Загрузка...', allLoaded: 'Все товары загружены', - emptyTitle: 'Упс! Здесь пока пусто', + emptyTitle: 'Здесь пока пусто', emptyDesc: 'В этой категории ещё нет товаров, но скоро они появятся', goHome: 'На главную', loading: 'Загрузка товаров...', @@ -339,7 +339,7 @@ export const ru: Translations = { subcategories: { loading: 'Загрузка подкатегорий...', retry: 'Попробовать снова', - emptyTitle: 'Упс! Подкатегорий пока нет', + emptyTitle: 'Подкатегорий пока нет', emptyDesc: 'В этом разделе ещё нет подкатегорий, но скоро они появятся', goHome: 'На главную', itemsInCategory: 'Товары в этой категории', @@ -1086,6 +1086,17 @@ export const ru: Translations = { remove: 'Удалить', errorTitle: 'Что-то пошло не так', errorDescription: 'Не удалось загрузить данные. Попробуйте ещё раз.', + ratingLabel: 'Рейтинг {{value}}', + discountLabel: 'Скидка {{value}}%', + slideLabel: 'Слайд {{value}}', + slidesLabel: 'Слайды', + previousProducts: 'Предыдущие товары', + nextProducts: 'Следующие товары', + closeDialog: 'Закрыть диалог', + dismiss: 'Скрыть', + qrCode: 'QR-код', + bankCardPayment: 'Оплата банковской картой', + guest: 'Гость', }, location: { allRegions: 'Все регионы', diff --git a/src/app/i18n/translations.ts b/src/app/i18n/translations.ts index ceade53..e8334de 100644 --- a/src/app/i18n/translations.ts +++ b/src/app/i18n/translations.ts @@ -1085,6 +1085,17 @@ export interface Translations { remove: string; errorTitle: string; errorDescription: string; + ratingLabel: string; + discountLabel: string; + slideLabel: string; + slidesLabel: string; + previousProducts: string; + nextProducts: string; + closeDialog: string; + dismiss: string; + qrCode: string; + bankCardPayment: string; + guest: string; }; location: { allRegions: string; diff --git a/src/app/pages/cart/cart.component.html b/src/app/pages/cart/cart.component.html index 9061471..c0ce9ba 100644 --- a/src/app/pages/cart/cart.component.html +++ b/src/app/pages/cart/cart.component.html @@ -284,7 +284,7 @@ - +
} diff --git a/src/app/pages/cart/cart.component.ts b/src/app/pages/cart/cart.component.ts index ac81d70..7975a3f 100644 --- a/src/app/pages/cart/cart.component.ts +++ b/src/app/pages/cart/cart.component.ts @@ -499,7 +499,7 @@ export class CartComponent implements OnDestroy { price: item.discount > 0 ? item.price * (1 - item.discount / 100) : item.price, })), customer: { - name: this.getTelegramUsername() || 'Guest', + name: this.getTelegramUsername() || this.i18n.t('common.guest'), email, phone, }, diff --git a/src/app/shared/ui/dialog/dialog.component.html b/src/app/shared/ui/dialog/dialog.component.html index d9e49ea..24408c7 100644 --- a/src/app/shared/ui/dialog/dialog.component.html +++ b/src/app/shared/ui/dialog/dialog.component.html @@ -19,7 +19,7 @@ type="button" class="app-dialog-panel__close" (click)="requestClose()" - aria-label="Close dialog" + [attr.aria-label]="'common.closeDialog' | translate" > × diff --git a/src/app/shared/ui/dialog/dialog.component.ts b/src/app/shared/ui/dialog/dialog.component.ts index b74bdbe..88032eb 100644 --- a/src/app/shared/ui/dialog/dialog.component.ts +++ b/src/app/shared/ui/dialog/dialog.component.ts @@ -10,6 +10,7 @@ import { SimpleChanges, ViewChild } from '@angular/core'; +import { TranslatePipe } from '../../../i18n/translate.pipe'; export type DialogSize = 'sm' | 'md' | 'lg'; @@ -19,6 +20,7 @@ const FOCUSABLE_SELECTOR = @Component({ selector: 'app-dialog', standalone: true, + imports: [TranslatePipe], templateUrl: './dialog.component.html', styleUrl: './dialog.component.scss', changeDetection: ChangeDetectionStrategy.OnPush diff --git a/src/app/widgets/ui/hero-widget.component.ts b/src/app/widgets/ui/hero-widget.component.ts index e555b22..3fb10eb 100644 --- a/src/app/widgets/ui/hero-widget.component.ts +++ b/src/app/widgets/ui/hero-widget.component.ts @@ -2,13 +2,14 @@ import { CommonModule } from '@angular/common'; import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges, computed, signal } from '@angular/core'; import { SectionConfig } from '../../shared/models/config'; import { HeroSlideData, HeroWidgetData } from '../contracts/widget-data.contract'; +import { TranslatePipe } from '../../i18n/translate.pipe'; const AUTOPLAY_INTERVAL_MS = 5000; @Component({ selector: 'app-hero-widget', standalone: true, - imports: [CommonModule], + imports: [CommonModule, TranslatePipe], template: `
@if (activeSlide(); as slide) { @@ -21,7 +22,7 @@ const AUTOPLAY_INTERVAL_MS = 5000; } @if (allSlides().length > 1) { -
+
@for (dot of allSlides(); track $index) { } diff --git a/src/app/widgets/ui/product-carousel-widget.component.ts b/src/app/widgets/ui/product-carousel-widget.component.ts index 107fba5..353e035 100644 --- a/src/app/widgets/ui/product-carousel-widget.component.ts +++ b/src/app/widgets/ui/product-carousel-widget.component.ts @@ -3,11 +3,12 @@ import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, Ou import { SectionConfig } from '../../shared/models/config'; import { CatalogProductGridComponent } from '../../features/website/catalog/components/product-grid/product-grid.component'; import { ProductCollectionWidgetData } from '../contracts/widget-data.contract'; +import { TranslatePipe } from '../../i18n/translate.pipe'; @Component({ selector: 'app-product-carousel-widget', standalone: true, - imports: [CommonModule, CatalogProductGridComponent], + imports: [CommonModule, CatalogProductGridComponent, TranslatePipe], template: `