fix(i18n): Add RTL Detection based on Config Set Language (#2100)
Some checks failed
Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
Build and Test / publish-tag (push) Has been skipped
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled

* Add rtl automatic detection to base.scss

* Implement RTL support for Arabic and Persian locales and update HTML direction attribute in renderPage component

* Update HTML direction attribute in renderPage component to prioritize frontmatter dir value

* Refactor renderPage component to simplify HTML direction attribute assignment by removing frontmatter dir fallback
This commit is contained in:
Amir Pourmand 2025-09-18 02:34:22 +03:30 committed by GitHub
parent 03ccac2872
commit 7a77f54e50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 1 deletions

View File

@ -231,8 +231,9 @@ export function renderPage(
)
const lang = componentData.fileData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en"
const direction = i18n(cfg.locale).direction ?? "ltr"
const doc = (
<html lang={lang}>
<html lang={lang} dir={direction}>
<Head {...componentData} />
<body data-slug={slug}>
<div id="quartz-root" class="page">

View File

@ -5,6 +5,7 @@ export default {
title: "غير معنون",
description: "لم يتم تقديم أي وصف",
},
direction: "rtl" as const,
components: {
callout: {
note: "ملاحظة",

View File

@ -21,6 +21,7 @@ export interface Translation {
title: string
description: string
}
direction?: "ltr" | "rtl"
components: {
callout: CalloutTranslation
backlinks: {

View File

@ -5,6 +5,7 @@ export default {
title: "بدون عنوان",
description: "توضیح خاصی اضافه نشده است",
},
direction: "rtl" as const,
components: {
callout: {
note: "یادداشت",