diff --git a/demo/.vitepress/config.js b/demo/.vitepress/config.js index 835b391..e68c5cc 100644 --- a/demo/.vitepress/config.js +++ b/demo/.vitepress/config.js @@ -6,6 +6,7 @@ const path = require('path') */ module.exports = (async () => { const base = await getBase() + return { ...base, @@ -25,13 +26,28 @@ module.exports = (async () => { title: 'Vue.js', description: 'Vue.js - The Progressive JavaScript Framework', + /** + * @type {import('../../src/vitepress/config').Config} + */ themeConfig: { logo: '/img/logo-vue.svg', algolia: { indexName: 'vuejs-v3', appId: 'BH4D9OD16A', - apiKey: 'bc6e8acb44ed4179c30d0a45d6140d3f' + apiKey: 'bc6e8acb44ed4179c30d0a45d6140d3f', + placeholder: 'Search on Vue theme', + translations: { + modal: { + searchBox: { + cancelButtonText: 'Abort', + resetButtonTitle: 'Clear search term' + }, + footer: { + searchByText: 'Search gracefully done by ' + } + } + } }, carbonAds: { diff --git a/src/vitepress/config.ts b/src/vitepress/config.ts index eedfc30..97ae52b 100644 --- a/src/vitepress/config.ts +++ b/src/vitepress/config.ts @@ -87,6 +87,55 @@ export interface AlgoliaSearchOptions { searchParameters?: any disableUserPersonalization?: boolean initialQuery?: string + translations?: Partial +} + +export interface DocSearchTranslations { + button?: ButtonTranslations + modal?: ModalTranslations +} + +export interface ButtonTranslations { + buttonText?: string + buttonAriaLabel?: string +} +export interface ModalTranslations extends ScreenStateTranslations { + searchBox?: { + resetButtonTitle?: string + resetButtonAriaLabel?: string + cancelButtonText?: string + cancelButtonAriaLabel?: string + } + footer?: { + selectText?: string + selectKeyAriaLabel?: string + navigateText?: string + navigateUpKeyAriaLabel?: string + navigateDownKeyAriaLabel?: string + closeText?: string + closeKeyAriaLabel?: string + searchByText?: string + } +} +export interface ScreenStateTranslations { + errorScreen?: { + titleText?: string + helpText?: string + } + startScreen?: { + recentSearchesTitle?: string + noRecentSearchesText?: string + saveRecentSearchButtonTitle?: string + removeRecentSearchButtonTitle?: string + favoriteSearchesTitle?: string + removeFavoriteSearchButtonTitle?: string + } + noResultsScreen?: { + noResultsText?: string + suggestedQueryText?: string + reportMissingResultsText?: string + reportMissingResultsLinkText?: string + } } export type NavItem = NavItemWithLink | NavItemWithChildren