test02/node_modules/@vuepress/theme-default/lib/node/utils/assignDefaultLocaleOptions.js
罗佳鸿 6aa1ebe342
Some checks are pending
部署文档 / deploy-gh-pages (push) Waiting to run
first commit
2024-08-13 10:11:19 +08:00

57 lines
1.4 KiB
JavaScript

export const DEFAULT_LOCALE_OPTIONS = {
// color mode
colorMode: 'auto',
colorModeSwitch: true,
// navbar
navbar: [],
logo: null,
repo: null,
selectLanguageText: 'Languages',
selectLanguageAriaLabel: 'Select language',
// sidebar
sidebar: 'heading',
sidebarDepth: 2,
// page meta
editLink: true,
editLinkText: 'Edit this page',
lastUpdated: true,
lastUpdatedText: 'Last Updated',
contributors: true,
contributorsText: 'Contributors',
// 404 page messages
notFound: [
`There's nothing here.`,
`How did we get here?`,
`That's a Four-Oh-Four.`,
`Looks like we've got some broken links.`,
],
backToHome: 'Take me home',
// a11y
openInNewWindow: 'open in new window',
toggleColorMode: 'toggle color mode',
toggleSidebar: 'toggle sidebar',
};
export const DEFAULT_LOCALE_DATA = {
// navbar
selectLanguageName: 'English',
};
/**
* Assign default options
*/
export const assignDefaultLocaleOptions = (localeOptions) => {
if (!localeOptions.locales) {
localeOptions.locales = {};
}
if (!localeOptions.locales['/']) {
localeOptions.locales['/'] = {};
}
Object.assign(localeOptions, {
...DEFAULT_LOCALE_OPTIONS,
...localeOptions,
});
Object.assign(localeOptions.locales['/'], {
...DEFAULT_LOCALE_DATA,
...localeOptions.locales['/'],
});
};