-
{pluralize(pages.length, "item")} with this tag.
+
+ {pluralize(pages.length, i18n(cfg.locale, "common.item"))}{" "}
+ {i18n(cfg.locale, "tagContent.withThisTag")}.
+
diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts
index 59942ebf5..a75f4ff46 100644
--- a/quartz/components/scripts/search.inline.ts
+++ b/quartz/components/scripts/search.inline.ts
@@ -306,7 +306,13 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
itemTile.classList.add("result-card")
itemTile.id = slug
itemTile.href = resolveUrl(slug).toString()
- itemTile.innerHTML = `
${title}
${htmlTags}
${content}
`
+ itemTile.innerHTML = `
${title}
${htmlTags}${
+ enablePreview && window.innerWidth > 600 ? "" : `
${content}
`
+ }`
+ itemTile.addEventListener("click", (event) => {
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return
+ hideSearch()
+ })
const handler = (event: MouseEvent) => {
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return
diff --git a/quartz/i18n/i18next.ts b/quartz/i18n/i18next.ts
new file mode 100644
index 000000000..39c446132
--- /dev/null
+++ b/quartz/i18n/i18next.ts
@@ -0,0 +1,37 @@
+import en from "./locales/en.json"
+import fr from "./locales/fr.json"
+
+const TRANSLATION = {
+ "en-US": en,
+ "fr-FR": fr,
+} as const
+
+type TranslationOptions = {
+ [key: string]: string
+}
+
+export const i18n = (lang = "en-US", key: string, options?: TranslationOptions) => {
+ const locale =
+ Object.keys(TRANSLATION).find(
+ (key) =>
+ key.toLowerCase() === lang.toLowerCase() || key.toLowerCase().includes(lang.toLowerCase()),
+ ) ?? "en-US"
+ const getTranslation = (key: string) => {
+ const keys = key.split(".")
+ let translationString: string | Record
=
+ TRANSLATION[locale as keyof typeof TRANSLATION]
+ keys.forEach((key) => {
+ // @ts-ignore
+ translationString = translationString[key]
+ })
+ return translationString
+ }
+ if (options) {
+ let translationString = getTranslation(key).toString()
+ Object.keys(options).forEach((key) => {
+ translationString = translationString.replace(`{{${key}}}`, options[key])
+ })
+ return translationString
+ }
+ return getTranslation(key).toString()
+}
diff --git a/quartz/i18n/locales/en.json b/quartz/i18n/locales/en.json
new file mode 100644
index 000000000..28b6dff2d
--- /dev/null
+++ b/quartz/i18n/locales/en.json
@@ -0,0 +1,37 @@
+{
+ "404": "Either this page is private or doesn't exist.",
+ "backlinks": {
+ "backlinks": "Backlinks",
+ "noBlacklinksFound": "No backlinks found"
+ },
+ "common": {
+ "item": "item"
+ },
+ "darkmode": {
+ "lightMode": "Light mode"
+ },
+ "folderContent": {
+ "underThisFolder": "under this folder"
+ },
+ "footer": {
+ "createdWith": "Created with"
+ },
+ "graph": {
+ "graphView": "Graph View"
+ },
+ "head": {
+ "noDescriptionProvided": "No description provided",
+ "untitled": "Untitled"
+ },
+ "recentNotes": {
+ "seeRemainingMore": "See {{remaining}} more"
+ },
+ "search": "Search",
+ "tableOfContent": "Table of Contents",
+ "tagContent": {
+ "showingFirst": "Showing first",
+ "totalTags": "total tags",
+ "withThisTag": "with this tag",
+ "found": "Found"
+ }
+}
diff --git a/quartz/i18n/locales/fr.json b/quartz/i18n/locales/fr.json
new file mode 100644
index 000000000..97f8f31bc
--- /dev/null
+++ b/quartz/i18n/locales/fr.json
@@ -0,0 +1,38 @@
+{
+ "404": "Soit cette page est privée, soit elle n'existe pas.",
+ "backlinks": {
+ "backlinks": "Rétroliens",
+ "noBlacklinksFound": "Aucun rétrolien trouvé"
+ },
+ "common": {
+ "item": "fichier"
+ },
+ "darkmode": {
+ "darkmode": "Thème sombre",
+ "lightMode": "Thème clair"
+ },
+ "folderContent": {
+ "underThisFolder": "dans ce dossier"
+ },
+ "footer": {
+ "createdWith": "Créé avec"
+ },
+ "graph": {
+ "graphView": "Vue Graphique"
+ },
+ "head": {
+ "noDescriptionProvided": "Aucune description n'a été fournie",
+ "untitled": "Sans titre"
+ },
+ "recentNotes": {
+ "seeRemainingMore": "Voir {{remaining}} plus"
+ },
+ "search": "Rechercher",
+ "tableOfContent": "Table des Matières",
+ "tagContent": {
+ "showingFirst": "Afficher en premier",
+ "totalTags": "tags totaux",
+ "withThisTag": "avec ce tag",
+ "found": "Trouvé"
+ }
+}