fix(copy): replace مظنه with قیمت in landing user-facing messages

Add persianTerminology helper and apply it when stripping store closed hints.
This commit is contained in:
2026-10-21 03:38:57 -04:00
parent a0a2b31713
commit 6a3d8f86e6
2 changed files with 27 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
/** جایگزینی «مظنه» و شکل‌های وابسته با «قیمت» در متن‌های نمایشی */
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)
}
+2 -1
View File
@@ -1,4 +1,5 @@
import { ref } from 'vue'
import { replaceMazanehTerminology } from '@/utils/persianTerminology'
import { useSettingsStore } from '@/store/settingsStore'
import { getTradeBuyPrice, getTradeSellPrice, lastPrice } from '@/utils/price'
@@ -173,7 +174,7 @@ export function isStoreClosed(): boolean {
export const STORE_CLOSED_TITLE = 'فروشگاه بسته است'
export function stripHtmlMessage(message: string): string {
return message.replace(/<[^>]*>/g, '').trim()
return replaceMazanehTerminology(message.replace(/<[^>]*>/g, '').trim())
}
export function getStoreClosedHint(customMessage?: unknown): string {