Alq
2024-02-11 3518ca9e2a04f326eda25ada2393a4bbfde10738
feat(i18n): localize the min read string (#838)

* feat(i18n): localize the min read string fixes #825

* chore: format
11 files modified
43 ■■■■■ changed files
quartz/components/ContentMeta.tsx 8 ●●●● patch | view | raw | blame | history
quartz/i18n/locales/ar-SA.ts 8 ●●●●● patch | view | raw | blame | history
quartz/i18n/locales/de-DE.ts 3 ●●●●● patch | view | raw | blame | history
quartz/i18n/locales/definition.ts 3 ●●●●● patch | view | raw | blame | history
quartz/i18n/locales/en-US.ts 3 ●●●●● patch | view | raw | blame | history
quartz/i18n/locales/es-ES.ts 3 ●●●●● patch | view | raw | blame | history
quartz/i18n/locales/fr-FR.ts 3 ●●●●● patch | view | raw | blame | history
quartz/i18n/locales/ja-JP.ts 3 ●●●●● patch | view | raw | blame | history
quartz/i18n/locales/nl-NL.ts 3 ●●●●● patch | view | raw | blame | history
quartz/i18n/locales/ro-RO.ts 3 ●●●●● patch | view | raw | blame | history
quartz/i18n/locales/uk-UA.ts 3 ●●●●● patch | view | raw | blame | history
quartz/components/ContentMeta.tsx
@@ -2,6 +2,7 @@
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
import readingTime from "reading-time"
import { classNames } from "../util/lang"
import { i18n } from "../i18n"
interface ContentMetaOptions {
  /**
@@ -30,8 +31,11 @@
      // Display reading time if enabled
      if (options.showReadingTime) {
        const { text: timeTaken, words: _words } = readingTime(text)
        segments.push(timeTaken)
        const { minutes, words: _words } = readingTime(text)
        const displayedTime = i18n(cfg.locale).components.contentMeta.readingTime({
          minutes: Math.ceil(minutes),
        })
        segments.push(displayedTime)
      }
      return <p class={classNames(displayClass, "content-meta")}>{segments.join(", ")}</p>
quartz/i18n/locales/ar-SA.ts
@@ -53,6 +53,14 @@
    tableOfContents: {
      title: "فهرس المحتويات",
    },
    contentMeta: {
      readingTime: ({ minutes }) =>
        minutes == 1
          ? `دقيقة أو أقل للقراءة`
          : minutes == 2
            ? `دقيقتان للقراءة`
            : `${minutes} دقائق للقراءة`,
    },
  },
  pages: {
    rss: {
quartz/i18n/locales/de-DE.ts
@@ -53,6 +53,9 @@
    tableOfContents: {
      title: "Inhaltsverzeichnis",
    },
    contentMeta: {
      readingTime: ({ minutes }) => `${minutes} min read`,
    },
  },
  pages: {
    rss: {
quartz/i18n/locales/definition.ts
@@ -55,6 +55,9 @@
    tableOfContents: {
      title: string
    }
    contentMeta: {
      readingTime: (variables: { minutes: number }) => string
    }
  }
  pages: {
    rss: {
quartz/i18n/locales/en-US.ts
@@ -53,6 +53,9 @@
    tableOfContents: {
      title: "Table of Contents",
    },
    contentMeta: {
      readingTime: ({ minutes }) => `${minutes} min read`,
    },
  },
  pages: {
    rss: {
quartz/i18n/locales/es-ES.ts
@@ -53,6 +53,9 @@
    tableOfContents: {
      title: "Tabla de Contenidos",
    },
    contentMeta: {
      readingTime: ({ minutes }) => `${minutes} min read`,
    },
  },
  pages: {
    rss: {
quartz/i18n/locales/fr-FR.ts
@@ -53,6 +53,9 @@
    tableOfContents: {
      title: "Table des Matières",
    },
    contentMeta: {
      readingTime: ({ minutes }) => `${minutes} min read`,
    },
  },
  pages: {
    rss: {
quartz/i18n/locales/ja-JP.ts
@@ -53,6 +53,9 @@
    tableOfContents: {
      title: "目次",
    },
    contentMeta: {
      readingTime: ({ minutes }) => `${minutes} min read`,
    },
  },
  pages: {
    rss: {
quartz/i18n/locales/nl-NL.ts
@@ -53,6 +53,9 @@
    tableOfContents: {
      title: "Inhoudsopgave",
    },
    contentMeta: {
      readingTime: ({ minutes }) => `${minutes} min read`,
    },
  },
  pages: {
    rss: {
quartz/i18n/locales/ro-RO.ts
@@ -53,6 +53,9 @@
    tableOfContents: {
      title: "Cuprins",
    },
    contentMeta: {
      readingTime: ({ minutes }) => `${minutes} min read`,
    },
  },
  pages: {
    rss: {
quartz/i18n/locales/uk-UA.ts
@@ -53,6 +53,9 @@
    tableOfContents: {
      title: "Зміст",
    },
    contentMeta: {
      readingTime: ({ minutes }) => `${minutes} min read`,
    },
  },
  pages: {
    rss: {