File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ afterBody: [
4545 category: ' Announcements' ,
4646 // from data-category-id
4747 categoryId: ' DIC_kwDOFxRnmM4B-Xg6' ,
48+ // from data-lang
49+ lang: ' en'
4850 }
4951 }),
5052],
@@ -90,6 +92,10 @@ type Options = {
9092 // where to put the comment input box relative to the comments
9193 // defaults to 'bottom'
9294 inputPosition? : " top" | " bottom"
95+
96+ // set your preference language here
97+ // defaults to 'en'
98+ lang? : string
9399 }
94100}
95101` ` `
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ type Options = {
1717 strict ?: boolean
1818 reactionsEnabled ?: boolean
1919 inputPosition ?: "top" | "bottom"
20+ lang ?: string
2021 }
2122}
2223
@@ -50,6 +51,7 @@ export default ((opts: Options) => {
5051 data-theme-url = {
5152 opts . options . themeUrl ?? `https://${ cfg . baseUrl ?? "example.com" } /static/giscus`
5253 }
54+ data-lang = { opts . options . lang ?? "en" }
5355 > </ div >
5456 )
5557 }
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ type GiscusElement = Omit<HTMLElement, "dataset"> & {
5555 strict : string
5656 reactionsEnabled : string
5757 inputPosition : "top" | "bottom"
58+ lang : string
5859 }
5960}
6061
@@ -78,7 +79,7 @@ document.addEventListener("nav", () => {
7879 giscusScript . setAttribute ( "data-strict" , giscusContainer . dataset . strict )
7980 giscusScript . setAttribute ( "data-reactions-enabled" , giscusContainer . dataset . reactionsEnabled )
8081 giscusScript . setAttribute ( "data-input-position" , giscusContainer . dataset . inputPosition )
81-
82+ giscusScript . setAttribute ( "data-lang" , giscusContainer . dataset . lang )
8283 const theme = document . documentElement . getAttribute ( "saved-theme" )
8384 if ( theme ) {
8485 giscusScript . setAttribute ( "data-theme" , getThemeUrl ( getThemeName ( theme ) ) )
You can’t perform that action at this time.
0 commit comments