File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -101,18 +101,21 @@ export default class VitePressI18n {
101101 }
102102
103103 // Search
104- if ( i18nOptions . searchProvider ) {
105- if ( i18nOptions . searchProvider === 'local' ) {
106- result . themeConfig . search . options . locales [
107- locale === i18nOptions . rootLocale ? 'root' : label
108- ] = LOCAL_SEARCH_TRANSLATIONS [ locale ] ;
109- } else {
110- result . themeConfig . search . options . locales [
111- locale === i18nOptions . rootLocale ? 'root' : label
112- ] = ALGOLIA_SEARCH_TRANSLATIONS [ locale ] ;
113- }
104+ const currentSearchProvider =
105+ i18nOptions . searchProvider ?? vitePressOptions . themeConfig ?. search ?. provider ;
106+
107+ if ( currentSearchProvider === 'local' ) {
108+ result . themeConfig . search . options . locales [
109+ locale === i18nOptions . rootLocale ? 'root' : label
110+ ] = LOCAL_SEARCH_TRANSLATIONS [ locale ] ;
111+ } else if ( currentSearchProvider === 'algolia' ) {
112+ result . themeConfig . search . options . locales [
113+ locale === i18nOptions . rootLocale ? 'root' : label
114+ ] = ALGOLIA_SEARCH_TRANSLATIONS [ locale ] ;
114115 }
115116
117+ delete vitePressOptions . themeConfig ?. search ;
118+
116119 const commonThemeConfig = LOCALES_TRANSLATIONS [ locale ] ;
117120
118121 if ( vitePressOptions . themeConfig ?. editLink ?. pattern ) {
You can’t perform that action at this time.
0 commit comments