Skip to content

chore(orama): translate search box #7799

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

Merged
merged 2 commits into from
Jun 2, 2025
Merged

chore(orama): translate search box #7799

merged 2 commits into from
Jun 2, 2025

Conversation

avivkeller
Copy link
Member

In v0.8.0 of @orama/react-components, we can supply a custom dictionary, allowing us to translate the search box.

@Copilot Copilot AI review requested due to automatic review settings May 31, 2025 22:12
@avivkeller avivkeller requested a review from a team as a code owner May 31, 2025 22:12
Copy link

vercel bot commented May 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Jun 2, 2025 4:32pm

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the search box to support full translation via a custom dictionary in the new @orama/react-components v0.8.0.

  • Flattened and expanded search/chat keys in the English locale file
  • Bumped @orama/react-components from v0.7.0 to v0.8.0
  • Exposed translationKeys and passed a dictionary prop into the OramaSearchBox

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
packages/i18n/locales/en.json Flattened searchBox.placeholder and added new translation keys
apps/site/package.json Updated @orama/react-components version to ^0.8.0
apps/site/components/Common/Search/utils.ts Added translationKeys array for mapping dictionary entries
apps/site/components/Common/Search/index.tsx Imported translationKeys; wired dictionary into Orama components
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (3)

packages/i18n/locales/en.json:241

  • The placeholder text ends with a comma instead of an ellipsis; it should match the original "Start typing...".
"searchPlaceholder": "Start typing,",

apps/site/components/Common/Search/index.tsx:86

  • [nitpick] This inline Object.fromEntries(...) is recreated on every render. Consider memoizing the dictionary with useMemo to avoid unnecessary recomputation.
dictionary={Object.fromEntries(translationKeys.map(key => [key, t(`components.search.${key}`)]))}

apps/site/components/Common/Search/index.tsx:86

  • New dictionary-driven behavior should be covered by a unit or integration test to verify all translation keys are passed correctly.
dictionary={Object.fromEntries(translationKeys.map(key => [key, t(`components.search.${key}`)]))}

Copy link

codecov bot commented May 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.46%. Comparing base (601b74e) to head (8ce4181).
Report is 12 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7799   +/-   ##
=======================================
  Coverage   75.46%   75.46%           
=======================================
  Files         101      101           
  Lines        8309     8309           
  Branches      218      218           
=======================================
  Hits         6270     6270           
  Misses       2037     2037           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@bjohansebas bjohansebas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bjohansebas bjohansebas added the github_actions:pull-request Trigger Pull Request Checks label May 31, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label May 31, 2025
Copy link
Contributor

github-actions bot commented May 31, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 99 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟠 82 🔗
/en/about/previous-releases 🟢 99 🟢 100 🟢 100 🟠 83 🔗
/en/download 🟢 98 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for discovering this!

Copy link
Collaborator

@bmuenzenmeyer bmuenzenmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat! small nit within

Co-authored-by: Brian Muenzenmeyer <brian.muenzenmeyer@gmail.com>
Signed-off-by: Aviv Keller <me@aviv.sh>
@avivkeller avivkeller added the github_actions:pull-request Trigger Pull Request Checks label Jun 2, 2025
@avivkeller avivkeller enabled auto-merge June 2, 2025 16:30
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Jun 2, 2025
@avivkeller avivkeller added this pull request to the merge queue Jun 2, 2025
Merged via the queue into main with commit b486a5a Jun 2, 2025
15 checks passed
@avivkeller avivkeller deleted the translate/orama branch June 2, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants