Files
boursecu_user/src/utils/persianTerminology.ts
T
safavimohadeseh78 2048680d7a feat(home): landing-style live chart, dynamic product tabs, and price copy
Replace home chart with landing live card, catalog-driven tabs, and smoother range transitions; normalize مظنه to قیمت in user-facing strings; add installment and zaarbox chart APIs.
2026-10-21 03:39:00 -04:00

26 lines
840 B
TypeScript

/** جایگزینی «مظنه» و شکل‌های وابسته با «قیمت» در متن‌های نمایشی به مشتری */
const MAZANEH_TO_PRICE: Array<[RegExp, string]> = [
[/مظنه‌های/g, 'قیمت‌های'],
[/مظنه‌ها/g, 'قیمت‌ها'],
[/مظنه‌ای/g, 'قیمتی'],
[/مظنهای/g, 'قیمتی'],
[/مظنهٔ/g, 'قیمت'],
[/مظنه/g, 'قیمت'],
]
export function replaceMazanehTerminology(text: string): string {
let result = text
for (const [pattern, replacement] of MAZANEH_TO_PRICE) {
result = result.replace(pattern, replacement)
}
return result
}
export function polishUserFacingCopy(text: unknown): string {
if (typeof text !== 'string') return ''
const trimmed = text.trim()
if (!trimmed) return ''
return replaceMazanehTerminology(trimmed)
}