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:
@@ -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)
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user