feat(giscus): expose language option for Comments component (#2012)
* add language support for Comment
* docs: let users know they can customize their language preference
| | |
| | | category: 'Announcements', |
| | | // from data-category-id |
| | | categoryId: 'DIC_kwDOFxRnmM4B-Xg6', |
| | | // from data-lang |
| | | lang: 'en' |
| | | } |
| | | }), |
| | | ], |
| | |
| | | // where to put the comment input box relative to the comments |
| | | // defaults to 'bottom' |
| | | inputPosition?: "top" | "bottom" |
| | | |
| | | // set your preference language here |
| | | // defaults to 'en' |
| | | lang?: string |
| | | } |
| | | } |
| | | ``` |
| | |
| | | strict?: boolean |
| | | reactionsEnabled?: boolean |
| | | inputPosition?: "top" | "bottom" |
| | | lang?: string |
| | | } |
| | | } |
| | | |
| | |
| | | data-theme-url={ |
| | | opts.options.themeUrl ?? `https://${cfg.baseUrl ?? "example.com"}/static/giscus` |
| | | } |
| | | data-lang={opts.options.lang ?? "en"} |
| | | ></div> |
| | | ) |
| | | } |
| | |
| | | strict: string |
| | | reactionsEnabled: string |
| | | inputPosition: "top" | "bottom" |
| | | lang: string |
| | | } |
| | | } |
| | | |
| | |
| | | giscusScript.setAttribute("data-strict", giscusContainer.dataset.strict) |
| | | giscusScript.setAttribute("data-reactions-enabled", giscusContainer.dataset.reactionsEnabled) |
| | | giscusScript.setAttribute("data-input-position", giscusContainer.dataset.inputPosition) |
| | | |
| | | giscusScript.setAttribute("data-lang", giscusContainer.dataset.lang) |
| | | const theme = document.documentElement.getAttribute("saved-theme") |
| | | if (theme) { |
| | | giscusScript.setAttribute("data-theme", getThemeUrl(getThemeName(theme))) |