From fedd04b2d8f0dabcf12ba184029bcf857d1fb302 Mon Sep 17 00:00:00 2001 From: avivkeller Date: Sat, 31 May 2025 18:10:57 -0400 Subject: [PATCH 1/2] chore(orama): translate search box --- apps/site/components/Common/Search/index.tsx | 9 +- apps/site/components/Common/Search/utils.ts | 17 +++ apps/site/package.json | 2 +- packages/i18n/locales/en.json | 17 ++- pnpm-lock.yaml | 125 +++++++++++++++---- 5 files changed, 137 insertions(+), 33 deletions(-) diff --git a/apps/site/components/Common/Search/index.tsx b/apps/site/components/Common/Search/index.tsx index 14a01db46a60d..0c12664b61826 100644 --- a/apps/site/components/Common/Search/index.tsx +++ b/apps/site/components/Common/Search/index.tsx @@ -21,7 +21,7 @@ type ResultMapDescription = { type ResultMapPath = { path: string; siteSection: string }; -import { themeConfig } from './utils'; +import { themeConfig, translationKeys } from './utils'; const uppercaseFirst = (word: string) => word.charAt(0).toUpperCase() + word.slice(1); @@ -63,9 +63,9 @@ const SearchButton: FC = () => { style={{ flexGrow: 1 }} colorScheme={colorScheme} themeConfig={themeConfig} - aria-label={t('components.search.searchBox.placeholder')} + aria-label={t('components.search.searchPlaceholder')} > - {t('components.search.searchBox.placeholder')} + {t('components.search.searchPlaceholder')} { HTMLTag: 'b', CSSClass: 'font-bold', }} + dictionary={Object.fromEntries( + translationKeys.map(key => [key, t(`components.search.${key}`)]) + )} searchParams={DEFAULT_ORAMA_QUERY_PARAMS} suggestions={DEFAULT_ORAMA_SUGGESTIONS} chatMarkdownLinkHref={({ href }) => { diff --git a/apps/site/components/Common/Search/utils.ts b/apps/site/components/Common/Search/utils.ts index b2bcc8d802725..dca1281ad7154 100644 --- a/apps/site/components/Common/Search/utils.ts +++ b/apps/site/components/Common/Search/utils.ts @@ -41,3 +41,20 @@ export const themeConfig = { }, }, }; + +export const translationKeys = [ + 'searchPlaceholder', + 'chatPlaceholder', + 'noResultsFoundFor', + 'suggestions', + 'seeAll', + 'addMore', + 'clearChat', + 'errorMessage', + 'disclaimer', + 'startYourSearch', + 'initErrorSearch', + 'initErrorChat', + 'chatButtonLabel', + 'searchButtonLabel', +] as const; diff --git a/apps/site/package.json b/apps/site/package.json index e61c670b06f42..f8c1a98ffc694 100644 --- a/apps/site/package.json +++ b/apps/site/package.json @@ -37,7 +37,7 @@ "@opentelemetry/instrumentation": "~0.200.0", "@opentelemetry/resources": "~1.30.1", "@opentelemetry/sdk-logs": "~0.200.0", - "@orama/react-components": "^0.7.0", + "@orama/react-components": "^0.8.0", "@oramacloud/client": "^2.1.4", "@radix-ui/react-slot": "^1.1.2", "@radix-ui/react-tabs": "^1.1.3", diff --git a/packages/i18n/locales/en.json b/packages/i18n/locales/en.json index aa91e44a3ad9e..de2ad497689bd 100644 --- a/packages/i18n/locales/en.json +++ b/packages/i18n/locales/en.json @@ -238,9 +238,20 @@ "tableOfContents": "Table of Contents" }, "search": { - "searchBox": { - "placeholder": "Start typing..." - } + "searchPlaceholder": "Start typing...", + "chatPlaceholder": "Ask me anything", + "noResultsFoundFor": "No results found for", + "suggestions": "Suggestions", + "seeAll": "See all", + "addMore": "Add more", + "clearChat": "Clear chat", + "errorMessage": "An error occurred while trying to search. Please try again.", + "disclaimer": "Orama can make mistakes. Please verify the information.", + "startYourSearch": "Start your search", + "initErrorSearch": "Unable to initialize search service", + "initErrorChat": "Unable to initialize chat service", + "chatButtonLabel": "Get a summary", + "searchButtonLabel": "Search" }, "blog": { "blogHeader": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4527ae25e4222..39d5acc0bc65f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -76,8 +76,8 @@ importers: specifier: ~0.200.0 version: 0.200.0(@opentelemetry/api@1.9.0) '@orama/react-components': - specifier: ^0.7.0 - version: 0.7.0(@stencil/core@4.27.0)(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + specifier: ^0.8.0 + version: 0.8.0(@stencil/core@4.30.0)(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) '@oramacloud/client': specifier: ^2.1.4 version: 2.1.4 @@ -2007,8 +2007,8 @@ packages: resolution: {integrity: sha512-s0OpmpQFSfMrmedAn9Lhg4KWJELHCU6uU9dtIJ28N8UGhf9Y55im5X8fEzwhwDwiSqN+ZPSNrDJF7ivf/AuRPQ==} engines: {node: '>=14'} - '@orama/core@0.1.5': - resolution: {integrity: sha512-BbRwGSR/rrlsF09sQ931Ee3IH5re3El23VplfmgZUKjiEqd0fjPdSbpybzEMybWDNp/0/UCG3OUs0HIiiFTWEg==} + '@orama/core@0.1.8': + resolution: {integrity: sha512-dVzUZsEJ/nnHyX+JjNO6KxTVY9bXV6YuEd+nJ5vDNn12S+cIobK3fSHdA4t2gI+2jVP9N67Ia5Uwxa8GNB743A==} '@orama/cuid2@2.2.3': resolution: {integrity: sha512-Lcak3chblMejdlSHgYU2lS2cdOhDpU6vkfIJH4m+YKvqQyLqs1bB8+w6NT1MG5bO12NUK2GFc34Mn2xshMIQ1g==} @@ -2020,8 +2020,8 @@ packages: resolution: {integrity: sha512-qtSrqCqRU93SjEBedz987tvWao1YQSELjBhGkHYGVP7Dg0lBWP6d+uZEIt5gxTAYio/YWWlhivmRABvRfPLmnQ==} engines: {node: '>= 16.0.0'} - '@orama/react-components@0.7.0': - resolution: {integrity: sha512-YAUkFwqKqYdL2Lh0VhQM+bQOx3vfZwxUurOX9+fS85/k+KIGPG18l5iDjWMAsA4WC96SEvV1xfSA67XMXEgwrA==} + '@orama/react-components@0.8.0': + resolution: {integrity: sha512-TVqjHS/Oa7EIe6srqu64DbkJshmotH0m+uGubV7hcUWHiABI8yQdYp1OhdLhsFNPnL+QnaaAh71yM5amBsJPNg==} peerDependencies: react: '>=17.0.0 <20.0.0' react-dom: '>=17.0.0 <20.0.0' @@ -2033,8 +2033,8 @@ packages: '@orama/orama': 3.1.6 '@oramacloud/client': ^2.1.1 - '@orama/wc-components@0.7.0': - resolution: {integrity: sha512-PuDxF4evv8al91lFLVDHC9i+ow4m4+p69WGEzCa/UhV5c7sifV4Bd4d7A0yATuyEJTuaQUtEtn4kM3EEfK994g==} + '@orama/wc-components@0.8.0': + resolution: {integrity: sha512-G0PUACezU7atmD8BlydqqUtIznOSfZ2rzf2oJ9jDfTtx4Nrzuo4mWdAOTqcsEZRxzIOjzgZkjLPJLFsOugfjqQ==} '@oramacloud/client@2.1.4': resolution: {integrity: sha512-uNPFs4wq/iOPbggCwTkVNbIr64Vfd7ZS/h+cricXVnzXWocjDTfJ3wLL4lr0qiSu41g8z+eCAGBqJ30RO2O4AA==} @@ -2484,6 +2484,46 @@ packages: '@reporters/github@1.7.2': resolution: {integrity: sha512-8mvTyKUxxDXkNIWfzv3FsHVwjr8JCwVtwidQws2neV6YgrsJW6OwTOBBhd01RKrDMXPxgpMQuFEfN9hRuUZGuA==} + '@rollup/rollup-darwin-arm64@4.34.9': + resolution: {integrity: sha512-0CY3/K54slrzLDjOA7TOjN1NuLKERBgk9nY5V34mhmuu673YNb+7ghaDUs6N0ujXR7fz5XaS5Aa6d2TNxZd0OQ==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.34.9': + resolution: {integrity: sha512-eOojSEAi/acnsJVYRxnMkPFqcxSMFfrw7r2iD9Q32SGkb/Q9FpUY1UlAu1DH9T7j++gZ0lHjnm4OyH2vCI7l7Q==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-linux-arm64-gnu@4.34.9': + resolution: {integrity: sha512-6TZjPHjKZUQKmVKMUowF3ewHxctrRR09eYyvT5eFv8w/fXarEra83A2mHTVJLA5xU91aCNOUnM+DWFMSbQ0Nxw==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.34.9': + resolution: {integrity: sha512-LD2fytxZJZ6xzOKnMbIpgzFOuIKlxVOpiMAXawsAZ2mHBPEYOnLRK5TTEsID6z4eM23DuO88X0Tq1mErHMVq0A==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-x64-gnu@4.34.9': + resolution: {integrity: sha512-FwBHNSOjUTQLP4MG7y6rR6qbGw4MFeQnIBrMe161QGaQoBQLqSUEKlHIiVgF3g/mb3lxlxzJOpIBhaP+C+KP2A==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.34.9': + resolution: {integrity: sha512-cYRpV4650z2I3/s6+5/LONkjIz8MBeqrk+vPXV10ORBnshpn8S32bPqQ2Utv39jCiDcO2eJTuSlPXpnvmaIgRA==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-win32-arm64-msvc@4.34.9': + resolution: {integrity: sha512-z4mQK9dAN6byRA/vsSgQiPeuO63wdiDxZ9yg9iyX2QTzKuQM7T4xlBoeUP/J8uiFkqxkcWndWi+W7bXdPbt27Q==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.34.9': + resolution: {integrity: sha512-AyleYRPU7+rgkMWbEh71fQlrzRfeP6SyMnRf9XX4fCdDPAJumdSBqYEcWPMzVQ4ScAl7E4oFfK0GUVn77xSwbw==} + cpu: [x64] + os: [win32] + '@rtsao/scc@1.1.0': resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} @@ -2884,8 +2924,8 @@ packages: resolution: {integrity: sha512-JtaY3FxmD+te+KSI2FJuEcfNC9T/DGGVf551babM7fAaXhjJUt7oSYurH1Devxd2+BOSUACCgt3buinx4UnmEA==} engines: {node: '>=18.0.0'} - '@stencil/core@4.27.0': - resolution: {integrity: sha512-GOA+pvSpwL734yijTB8+LHesqPq3o/K6IaCrNoZybNVpe6lgVfvciDwPeP1XOj6JZpA/Lp8Uh3U9znoS8qgwOA==} + '@stencil/core@4.30.0': + resolution: {integrity: sha512-rInn2BaN3ISgtz+yfOeiTvAvY+xjz8g5v9hDtQMIP6uefjO6JHXGhUJw2CujnuEOWjYeVR/BYdZJTi0dWN9/vQ==} engines: {node: '>=16.0.0', npm: '>=7.10.0'} hasBin: true @@ -9947,7 +9987,7 @@ snapshots: '@opentelemetry/semantic-conventions@1.32.0': {} - '@orama/core@0.1.5': + '@orama/core@0.1.8': dependencies: '@orama/cuid2': 2.2.3 dedent: 1.5.3 @@ -9964,10 +10004,10 @@ snapshots: '@orama/orama@3.1.6': {} - '@orama/react-components@0.7.0(@stencil/core@4.27.0)(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': + '@orama/react-components@0.8.0(@stencil/core@4.30.0)(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': dependencies: - '@orama/wc-components': 0.7.0 - '@stencil/react-output-target': 0.8.2(@stencil/core@4.27.0)(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + '@orama/wc-components': 0.8.0 + '@stencil/react-output-target': 0.8.2(@stencil/core@4.30.0)(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) react: 19.1.0 react-dom: 19.1.0(react@19.1.0) transitivePeerDependencies: @@ -9975,22 +10015,22 @@ snapshots: - '@types/react' - babel-plugin-macros - '@orama/switch@3.1.6(@orama/core@0.1.5)(@orama/orama@3.1.6)(@oramacloud/client@2.1.4)': + '@orama/switch@3.1.6(@orama/core@0.1.8)(@orama/orama@3.1.6)(@oramacloud/client@2.1.4)': dependencies: - '@orama/core': 0.1.5 + '@orama/core': 0.1.8 '@orama/orama': 3.1.6 '@oramacloud/client': 2.1.4 - '@orama/wc-components@0.7.0': + '@orama/wc-components@0.8.0': dependencies: - '@orama/core': 0.1.5 + '@orama/core': 0.1.8 '@orama/highlight': 0.1.9 '@orama/orama': 3.1.6 - '@orama/switch': 3.1.6(@orama/core@0.1.5)(@orama/orama@3.1.6)(@oramacloud/client@2.1.4) + '@orama/switch': 3.1.6(@orama/core@0.1.8)(@orama/orama@3.1.6)(@oramacloud/client@2.1.4) '@oramacloud/client': 2.1.4 '@phosphor-icons/webcomponents': 2.1.5 - '@stencil/core': 4.27.0 - '@stencil/store': 2.1.3(@stencil/core@4.27.0) + '@stencil/core': 4.30.0 + '@stencil/store': 2.1.3(@stencil/core@4.30.0) dompurify: 3.2.5 highlight.js: 11.11.1 markdown-it: 14.1.0 @@ -10422,6 +10462,30 @@ snapshots: '@actions/core': 1.11.1 stack-utils: 2.0.6 + '@rollup/rollup-darwin-arm64@4.34.9': + optional: true + + '@rollup/rollup-darwin-x64@4.34.9': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.34.9': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.34.9': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.34.9': + optional: true + + '@rollup/rollup-linux-x64-musl@4.34.9': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.34.9': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.34.9': + optional: true + '@rtsao/scc@1.1.0': {} '@rushstack/eslint-patch@1.11.0': {} @@ -11055,12 +11119,21 @@ snapshots: '@smithy/types': 4.2.0 tslib: 2.8.1 - '@stencil/core@4.27.0': {} + '@stencil/core@4.30.0': + optionalDependencies: + '@rollup/rollup-darwin-arm64': 4.34.9 + '@rollup/rollup-darwin-x64': 4.34.9 + '@rollup/rollup-linux-arm64-gnu': 4.34.9 + '@rollup/rollup-linux-arm64-musl': 4.34.9 + '@rollup/rollup-linux-x64-gnu': 4.34.9 + '@rollup/rollup-linux-x64-musl': 4.34.9 + '@rollup/rollup-win32-arm64-msvc': 4.34.9 + '@rollup/rollup-win32-x64-msvc': 4.34.9 - '@stencil/react-output-target@0.8.2(@stencil/core@4.27.0)(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': + '@stencil/react-output-target@0.8.2(@stencil/core@4.30.0)(@types/react@19.1.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)': dependencies: '@lit/react': 1.0.7(@types/react@19.1.2) - '@stencil/core': 4.27.0 + '@stencil/core': 4.30.0 html-react-parser: 5.2.3(@types/react@19.1.2)(react@19.1.0) react: 19.1.0 react-dom: 19.1.0(react@19.1.0) @@ -11069,9 +11142,9 @@ snapshots: transitivePeerDependencies: - '@types/react' - '@stencil/store@2.1.3(@stencil/core@4.27.0)': + '@stencil/store@2.1.3(@stencil/core@4.30.0)': dependencies: - '@stencil/core': 4.27.0 + '@stencil/core': 4.30.0 '@storybook/addon-controls@8.6.12(storybook@8.6.12(prettier@3.5.3))': dependencies: From 8ce4181fbea6d5954e0cb3a9cc9da2003110a7e3 Mon Sep 17 00:00:00 2001 From: Aviv Keller Date: Mon, 2 Jun 2025 12:30:28 -0400 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Brian Muenzenmeyer Signed-off-by: Aviv Keller --- packages/i18n/locales/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/i18n/locales/en.json b/packages/i18n/locales/en.json index de2ad497689bd..446608b40ef35 100644 --- a/packages/i18n/locales/en.json +++ b/packages/i18n/locales/en.json @@ -246,11 +246,11 @@ "addMore": "Add more", "clearChat": "Clear chat", "errorMessage": "An error occurred while trying to search. Please try again.", - "disclaimer": "Orama can make mistakes. Please verify the information.", + "disclaimer": "AI summaries can make mistakes. Please verify the information.", "startYourSearch": "Start your search", "initErrorSearch": "Unable to initialize search service", "initErrorChat": "Unable to initialize chat service", - "chatButtonLabel": "Get a summary", + "chatButtonLabel": "Get an AI summary", "searchButtonLabel": "Search" }, "blog": {