Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline (Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/* packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
17 lines
543 B
TypeScript
17 lines
543 B
TypeScript
export type TextDirection = "ltr" | "rtl";
|
|
|
|
const RTL_LANGUAGE_PREFIXES = ["ar", "fa", "he", "ur"] as const;
|
|
|
|
function primaryLanguageTag(localeTag: string): string {
|
|
const normalized = localeTag.trim().toLowerCase();
|
|
const [primary] = normalized.split(/[-_]/);
|
|
return primary ?? normalized;
|
|
}
|
|
|
|
export function textDirectionForLocale(localeTag: string): TextDirection {
|
|
const primary = primaryLanguageTag(localeTag);
|
|
return RTL_LANGUAGE_PREFIXES.includes(primary as (typeof RTL_LANGUAGE_PREFIXES)[number])
|
|
? "rtl"
|
|
: "ltr";
|
|
}
|