Skip to content

Commit

Permalink
add default implementation of the DocSearchTranslations
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts committed Nov 22, 2021
1 parent f520428 commit 86ba124
Showing 1 changed file with 92 additions and 2 deletions.
94 changes: 92 additions & 2 deletions packages/website/docs/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,52 @@ Learn more on the [Navigator API][11] documentation.
Allow translations of any raw text present in the DocSearch button or modal components.

See the [default implementation](https://github.com/algolia/docsearch/blob/next/packages/docsearch-react/src/DocSearch.tsx#L20-L23)
<details><summary>docSearchTranslations</summary>
<div>

```ts
const translations: DocSearchTranslations = {
button: {
buttonText: 'Search',
buttonAriaLabel: 'Search',
},
modal: {
searchBox: {
resetButtonTitle: 'Clear the query',
resetButtonAriaLabel: 'Clear the query',
cancelButtonText: 'Cancel',
cancelButtonAriaLabel: 'Cancel',
},
startScreen: {
recentSearchesTitle: 'Recent',
noRecentSearchesText: 'No recent searches',
saveRecentSearchButtonTitle: 'Save this search',
removeRecentSearchButtonTitle: 'Remove this search from history',
favoriteSearchesTitle: 'Favorite',
removeFavoriteSearchButtonTitle: 'Remove this search from favorites',
},
errorScreen: {
titleText: 'Unable to fetch results',
helpText: 'You might want to check your network connection.',
},
footer: {
selectText: 'to select',
navigateText: 'to navigate',
closeText: 'to close',
searchByText: 'Search by',
},
noResultsScreen: {
noResultsText: 'No results for',
suggestedQueryText: 'Try searching for',
openIssueText: 'Believe this query should return results?',
openIssueLinkText: 'Let us know',
},
},
};
```

</div>
</details>

</TabItem>

Expand Down Expand Up @@ -217,7 +262,52 @@ Learn more on the [Navigator API][11] documentation.
Allow translations of any raw text present in the DocSearch button or modal components.

See the [default implementation](https://github.com/algolia/docsearch/blob/next/packages/docsearch-react/src/DocSearch.tsx#L20-L23)
<details><summary>docSearchTranslations</summary>
<div>

```ts
const translations: DocSearchTranslations = {
button: {
buttonText: 'Search',
buttonAriaLabel: 'Search',
},
modal: {
searchBox: {
resetButtonTitle: 'Clear the query',
resetButtonAriaLabel: 'Clear the query',
cancelButtonText: 'Cancel',
cancelButtonAriaLabel: 'Cancel',
},
startScreen: {
recentSearchesTitle: 'Recent',
noRecentSearchesText: 'No recent searches',
saveRecentSearchButtonTitle: 'Save this search',
removeRecentSearchButtonTitle: 'Remove this search from history',
favoriteSearchesTitle: 'Favorite',
removeFavoriteSearchButtonTitle: 'Remove this search from favorites',
},
errorScreen: {
titleText: 'Unable to fetch results',
helpText: 'You might want to check your network connection.',
},
footer: {
selectText: 'to select',
navigateText: 'to navigate',
closeText: 'to close',
searchByText: 'Search by',
},
noResultsScreen: {
noResultsText: 'No results for',
suggestedQueryText: 'Try searching for',
openIssueText: 'Believe this query should return results?',
openIssueLinkText: 'Let us know',
},
},
};
```

</div>
</details>

</TabItem>

Expand Down

0 comments on commit 86ba124

Please sign in to comment.