From a0d6daa3b4d736a9fe29b2ad15bea5f670f79dfa Mon Sep 17 00:00:00 2001
From: Alq <ahmed.elq53@gmail.com>
Date: Sat, 10 Feb 2024 17:02:28 +0000
Subject: [PATCH] feat(i18n): add Arabic translation (#837)
---
quartz/components/RecentNotes.tsx | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/quartz/components/RecentNotes.tsx b/quartz/components/RecentNotes.tsx
index cb14b33..f8f6de4 100644
--- a/quartz/components/RecentNotes.tsx
+++ b/quartz/components/RecentNotes.tsx
@@ -5,9 +5,11 @@
import style from "./styles/recentNotes.scss"
import { Date, getDate } from "./Date"
import { GlobalConfiguration } from "../cfg"
+import { i18n } from "../i18n"
+import { classNames } from "../util/lang"
interface Options {
- title: string
+ title?: string
limit: number
linkToMore: SimpleSlug | false
filter: (f: QuartzPluginData) => boolean
@@ -15,7 +17,6 @@
}
const defaultOptions = (cfg: GlobalConfiguration): Options => ({
- title: "Recent Notes",
limit: 3,
linkToMore: false,
filter: () => true,
@@ -23,17 +24,16 @@
})
export default ((userOpts?: Partial<Options>) => {
- function RecentNotes(props: QuartzComponentProps) {
- const { allFiles, fileData, displayClass, cfg } = props
+ function RecentNotes({ allFiles, fileData, displayClass, cfg }: QuartzComponentProps) {
const opts = { ...defaultOptions(cfg), ...userOpts }
const pages = allFiles.filter(opts.filter).sort(opts.sort)
const remaining = Math.max(0, pages.length - opts.limit)
return (
- <div class={`recent-notes ${displayClass}`}>
- <h3>{opts.title}</h3>
+ <div class={classNames(displayClass, "recent-notes")}>
+ <h3>{opts.title ?? i18n(cfg.locale).components.recentNotes.title}</h3>
<ul class="recent-ul">
{pages.slice(0, opts.limit).map((page) => {
- const title = page.frontmatter?.title
+ const title = page.frontmatter?.title ?? i18n(cfg.locale).propertyDefaults.title
const tags = page.frontmatter?.tags ?? []
return (
@@ -48,7 +48,7 @@
</div>
{page.dates && (
<p class="meta">
- <Date date={getDate(cfg, page)!} />
+ <Date date={getDate(cfg, page)!} locale={cfg.locale} />
</p>
)}
<ul class="tags">
@@ -70,7 +70,9 @@
</ul>
{opts.linkToMore && remaining > 0 && (
<p>
- <a href={resolveRelative(fileData.slug!, opts.linkToMore)}>See {remaining} more →</a>
+ <a href={resolveRelative(fileData.slug!, opts.linkToMore)}>
+ {i18n(cfg.locale).components.recentNotes.seeRemainingMore({ remaining })}
+ </a>
</p>
)}
</div>
--
Gitblit v1.10.0