mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
fix(plugin-shikiji): in copy-code, unknown locales fallback not set (#348)
This commit is contained in:
parent
11b57c4f36
commit
c09895ef1c
@ -13,7 +13,7 @@ function createMarkdown(options: boolean | CopyCodeOptions = {}, lang = 'en-US')
|
||||
env: { isDebug: false },
|
||||
siteData: {
|
||||
lang,
|
||||
locales: { '/': { lang }, '/zh/': { lang: 'zh-CN' }, '/en/': { lang: 'en-US' } },
|
||||
locales: { '/': { lang }, '/zh/': { lang: 'zh-CN' }, '/en/': { lang: 'en-US' }, '/xxx/': { lang: 'unknown' } },
|
||||
},
|
||||
} as unknown as App
|
||||
copyCodeButtonPlugin(md, app, options)
|
||||
|
||||
@ -32,7 +32,7 @@ export function createCopyCodeButtonRender(app: App, options?: boolean | CopyCod
|
||||
return (filePathRelative: string) => {
|
||||
const relativePath = ensureLeadingSlash(filePathRelative)
|
||||
const localePath = resolveLocalePath(locales, relativePath)
|
||||
const { title, copied } = locales[localePath]
|
||||
const { title, copied } = locales[localePath] || locales['/']
|
||||
|
||||
return `<button class="${className}" title="${title}" data-copied="${copied}"></button>`
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user