[i18n] allow translating docsearch labels
See original GitHub issueDiscussed in https://github.com/vuejs/vitepress/discussions/1368
<div type='discussions-op-text'>Originally posted by Zogsha September 19, 2022 Hi, thanks for your work on vitepress!
My documentation site is written in French, so I need the Docsearch component in French.
I have two problems :
-
There is a
algolia.buttonText
option inthemeConfig
. I set it to “Rechercher” instead of the default “Search”, but whenever I click on the search component or use “CTRL+K”, the placeholder turns back to “Search”. It only displays “Rechercher” when the page refreshes. I only tested in dev. -
In the Docsearch API Reference, there is
translations
option (https://docsearch.algolia.com/docs/api#translations). I can’t figure out how to configure it.
I think 1. is not intended, but I didn’t look further. Is 2. intended ? If that is the case, do you plan to let us translate the Doscsearch modal via algolia
config in themeConfig
?
Thanks, Aliosha</div>
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Well currently at the initial render, we display placeholder that mimics Algolia search button, and when user clicks on the button, Algolia will render its button.
So, we should pass in those VitePress config to Algolia I guess 👀
For (2), the
translations
key… maybe we should support it? I mean if it’s set, we use that for VitePress’s placeholder too.@brc-dd Thanks a lot, I will give it a try.