From ce413b4bae40a21e354b2e065fda60045ae28ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Silviu=20Loren=C8=9B?= <124451350+smilorent@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:26:45 +0200 Subject: [PATCH 1/3] feat(i18n): add Romanian to i18n (#821) --- quartz/i18n/index.ts | 2 ++ quartz/i18n/locales/ro-RO.ts | 65 ++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 quartz/i18n/locales/ro-RO.ts diff --git a/quartz/i18n/index.ts b/quartz/i18n/index.ts index 9e14ffeea..579f19e4a 100644 --- a/quartz/i18n/index.ts +++ b/quartz/i18n/index.ts @@ -4,6 +4,7 @@ import fr from "./locales/fr-FR" import ja from "./locales/ja-JP" import de from "./locales/de-DE" import nl from "./locales/nl-NL" +import ro from "./locales/ro-RO" export const TRANSLATIONS = { "en-US": en, @@ -11,6 +12,7 @@ export const TRANSLATIONS = { "ja-JP": ja, "de-DE": de, "nl-NL": nl, + "ro-RO": ro, } as const export const i18n = (locale: ValidLocale): Translation => TRANSLATIONS[locale ?? "en-US"] diff --git a/quartz/i18n/locales/ro-RO.ts b/quartz/i18n/locales/ro-RO.ts new file mode 100644 index 000000000..8fce4a90d --- /dev/null +++ b/quartz/i18n/locales/ro-RO.ts @@ -0,0 +1,65 @@ +import { Translation } from "./definition" + +export default { + propertyDefaults: { + title: "Fără titlu", + description: "Nici o descriere furnizată", + }, + components: { + backlinks: { + title: "Legături înapoi", + noBacklinksFound: "Nu s-au găsit legături înapoi", + }, + themeToggle: { + lightMode: "Modul luminos", + darkMode: "Modul întunecat", + }, + explorer: { + title: "Explorator", + }, + footer: { + createdWith: "Creat cu", + }, + graph: { + title: "Graf", + }, + recentNotes: { + title: "Notițe recente", + seeRemainingMore: ({ remaining }) => `Vezi încă ${remaining} →`, + }, + transcludes: { + transcludeOf: ({ targetSlug }) => `Extras din ${targetSlug}`, + linkToOriginal: "Legătură către original", + }, + search: { + title: "Căutare", + searchBarPlaceholder: "Introduceți termenul de căutare...", + }, + tableOfContents: { + title: "Cuprins", + }, + }, + pages: { + rss: { + recentNotes: "Notițe recente", + lastFewNotes: ({ count }) => `Ultimele ${count} notițe`, + }, + error: { + title: "Pagina nu a fost găsită", + notFound: "Fie această pagină este privată, fie nu există.", + }, + folderContent: { + folder: "Dosar", + itemsUnderFolder: ({ count }) => + count === 1 ? "1 articol în acest dosar." : `${count} elemente în acest dosar.`, + }, + tagContent: { + tag: "Etichetă", + tagIndex: "Indexul etichetelor", + itemsUnderTag: ({ count }) => + count === 1 ? "1 articol cu această etichetă." : `${count} articole cu această etichetă.`, + showingFirst: ({ count }) => `Se afișează primele ${count} etichete.`, + totalTags: ({ count }) => `Au fost găsite ${count} etichete în total.`, + }, + }, +} as const satisfies Translation From 2578597f7ec7e932f5e30e2c38995dc9dd6eac75 Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:29:47 -0500 Subject: [PATCH 2/3] chore(lang): lang element based on frontmatter or default locale (#819) default locale Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --- quartz/components/renderPage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index 1ed05a704..d6bcf0a95 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -209,8 +209,10 @@ export function renderPage( ) + const lang = componentData.frontmatter?.lang ?? cfg.locale.split("-")[0] + const doc = ( - +