Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i18n] allow translating docsearch labels #1381

Closed
brc-dd opened this issue Sep 21, 2022 Discussed in #1368 · 5 comments · Fixed by #1339
Closed

[i18n] allow translating docsearch labels #1381

brc-dd opened this issue Sep 21, 2022 Discussed in #1368 · 5 comments · Fixed by #1339
Labels
enhancement New feature or request theme Related to the theme

Comments

@brc-dd
Copy link
Member

brc-dd commented Sep 21, 2022

Discussed in #1368

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 :

  1. There is a algolia.buttonText option in themeConfig. 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.

  2. 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

@brc-dd brc-dd added enhancement New feature or request theme Related to the theme labels Sep 21, 2022
@brc-dd brc-dd mentioned this issue Sep 21, 2022
12 tasks
@kiaking
Copy link
Member

kiaking commented Oct 31, 2022

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
Copy link
Member Author

brc-dd commented Oct 31, 2022

@fake-car
Copy link

fake-car commented Dec 1, 2022

Could the rest apis supported? Like resultsFooterComponent or transformSearchClient

@brc-dd
Copy link
Member Author

brc-dd commented Dec 5, 2022

@fake-car I haven't tested those, but IG that would break the app as the resultant site data after that won't be serializable. You can however register a custom component in one of the available navbar slots if you want better customization.

@fake-car
Copy link

fake-car commented Dec 8, 2022

@brc-dd Thanks a lot, I will give it a try.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request theme Related to the theme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants