mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
Improve product cards/pagination, Farsi locale fonts, and super-admin migrate UI.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
2e40d5eb4c
commit
f5b2193ba1
@@ -0,0 +1,22 @@
|
||||
/** Arabic / Persian script ranges (including presentation forms). */
|
||||
const RTL_SCRIPT_RE =
|
||||
/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/
|
||||
|
||||
export function isRtlScript(text: string | null | undefined): boolean {
|
||||
if (!text) return false
|
||||
return RTL_SCRIPT_RE.test(text)
|
||||
}
|
||||
|
||||
export type TextLocaleAttrs = {
|
||||
lang: 'fa' | 'en'
|
||||
dir: 'rtl' | 'ltr'
|
||||
className: string | undefined
|
||||
}
|
||||
|
||||
/** Font + direction attrs for mixed FA/EN content fields. */
|
||||
export function textLocaleAttrs(text: string | null | undefined): TextLocaleAttrs {
|
||||
if (isRtlScript(text)) {
|
||||
return { lang: 'fa', dir: 'rtl', className: 'faText' }
|
||||
}
|
||||
return { lang: 'en', dir: 'ltr', className: undefined }
|
||||
}
|
||||
Reference in New Issue
Block a user