feat(pdf): roll out shared RTL layout to all templates

Introduce createRtlStyleHelpers and a single rtl flag on RenderProvider,
migrate every template page to mirrored layout styles, and rename
alignRight to alignEnd. Fix plain rich text rendering via PdfText
paragraph renderers and map legacy Times New Roman to Times-Roman.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Amruth Pillai
2026-05-25 16:29:50 +02:00
parent 86fff7237f
commit 24c882fa9f
28 changed files with 501 additions and 276 deletions
+14 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { defaultLocale, isLocale } from "./locale";
import { defaultLocale, isLocale, isRTL } from "./locale";
describe("defaultLocale", () => {
it("is en-US", () => {
@@ -40,3 +40,16 @@ describe("isLocale", () => {
expect(isLocale([])).toBe(false);
});
});
describe("isRTL", () => {
it.each([
["ar-SA", true],
["he-IL", true],
["fa-IR", true],
["en-US", false],
["en-GB", false],
["fr-FR", false],
])("returns %s → %s", (locale, expected) => {
expect(isRTL(locale)).toBe(expected);
});
});
+1 -1
View File
@@ -84,6 +84,6 @@ const RTL_LANGUAGES = new Set([
]);
export function isRTL(locale: string): boolean {
const language = locale.split("-")[0].toLowerCase();
const language = locale.split("-")[0]?.toLowerCase() ?? "";
return RTL_LANGUAGES.has(language);
}