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

use algolia button text from theme config #713

Closed
3 tasks done
RainKolwa opened this issue Jun 4, 2022 · 2 comments · Fixed by #747
Closed
3 tasks done

use algolia button text from theme config #713

RainKolwa opened this issue Jun 4, 2022 · 2 comments · Fixed by #747
Labels
enhancement New feature or request theme Related to the theme
Milestone

Comments

@RainKolwa
Copy link
Contributor

Describe the bug

If I configured algolia translation in theme config like:

{
  "themeConfig": {
    "algolia": {
      "translations": {
        "button": {
          "buttonText": "搜索",
          "buttonAriaLabel": "搜索"
        }
      }
    }
  }
}

When I click the search button, the text of the button changes.

Reproduction

Expected behavior

<span class="DocSearch-Button-Placeholder">Search</span>

It would be nice if the text in search box could be using the text from theme config.

System Info

-

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@RainKolwa RainKolwa added the bug: pending triage Maybe a bug, waiting for confirmation label Jun 4, 2022
@kiaking kiaking added enhancement New feature or request theme Related to the theme and removed bug: pending triage Maybe a bug, waiting for confirmation labels Jun 6, 2022
@kiaking kiaking added this to the v1.0.0 milestone Jun 6, 2022
@kiaking
Copy link
Member

kiaking commented Jun 6, 2022

We should have this! But not sure about the option structure. So I guess Algolia already has that option 👀 But we're not using Algolia Dom structure directly, due to design differences. So I think we could have simpler option for VitePress. Maybe:

algolia: {
  appId: '...',
  apiKey: '...',
  indexName: '...',
  buttonText: '搜索'
}

@RainKolwa
Copy link
Contributor Author

I noticed that we used theme.algolia to initialize the search box, maybe it's better to respect the origin config from algolia. Otherwise, we have to config the text twice.

const options = Object.assign({}, userOptions, {

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.

2 participants