The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(giscus): expose language option for Comments component (#2012)

* add language support for Comment

* docs: let users know they can customize their language preference

authored by

Jiangnan Li and committed by
GitHub
cdd0be2a 9de370ae

+10 -1
+6
docs/features/comments.md
··· 45 45 category: 'Announcements', 46 46 // from data-category-id 47 47 categoryId: 'DIC_kwDOFxRnmM4B-Xg6', 48 + // from data-lang 49 + lang: 'en' 48 50 } 49 51 }), 50 52 ], ··· 90 92 // where to put the comment input box relative to the comments 91 93 // defaults to 'bottom' 92 94 inputPosition?: "top" | "bottom" 95 + 96 + // set your preference language here 97 + // defaults to 'en' 98 + lang?: string 93 99 } 94 100 } 95 101 ```
+2
quartz/components/Comments.tsx
··· 17 17 strict?: boolean 18 18 reactionsEnabled?: boolean 19 19 inputPosition?: "top" | "bottom" 20 + lang?: string 20 21 } 21 22 } 22 23 ··· 50 51 data-theme-url={ 51 52 opts.options.themeUrl ?? `https://${cfg.baseUrl ?? "example.com"}/static/giscus` 52 53 } 54 + data-lang={opts.options.lang ?? "en"} 53 55 ></div> 54 56 ) 55 57 }
+2 -1
quartz/components/scripts/comments.inline.ts
··· 55 55 strict: string 56 56 reactionsEnabled: string 57 57 inputPosition: "top" | "bottom" 58 + lang: string 58 59 } 59 60 } 60 61 ··· 78 79 giscusScript.setAttribute("data-strict", giscusContainer.dataset.strict) 79 80 giscusScript.setAttribute("data-reactions-enabled", giscusContainer.dataset.reactionsEnabled) 80 81 giscusScript.setAttribute("data-input-position", giscusContainer.dataset.inputPosition) 81 - 82 + giscusScript.setAttribute("data-lang", giscusContainer.dataset.lang) 82 83 const theme = document.documentElement.getAttribute("saved-theme") 83 84 if (theme) { 84 85 giscusScript.setAttribute("data-theme", getThemeUrl(getThemeName(theme)))