11'use client' ;
22
3+ import { tString , useLanguage } from '@/intl/client' ;
34import type { SiteSection } from '@gitbook/api' ;
45import { SegmentedControl , SegmentedControlItem } from '../primitives/SegmentedControl' ;
56import { useSearch } from './useSearch' ;
@@ -17,6 +18,7 @@ export function SearchScopeToggle(props: {
1718} ) {
1819 const { spaceTitle, section, withVariants, withSections, withSiteVariants } = props ;
1920 const [ state , setSearchState ] = useSearch ( ) ;
21+ const language = useLanguage ( ) ;
2022
2123 if ( ! state ) {
2224 return null ;
@@ -28,22 +30,30 @@ export function SearchScopeToggle(props: {
2830 < SegmentedControl className = "animate-scale-in @max-md:flex-col" >
2931 < SegmentedControlItem
3032 active = { state . scope === 'current' }
31- icon = { section ?. icon }
32- label = { section ?. title }
33+ icon = { section ?. icon ?? 'crosshairs' }
34+ label = { tString (
35+ language ,
36+ 'search_scope_current_depth_single' ,
37+ section ?. title
38+ ) }
3339 onClick = { ( ) =>
3440 setSearchState ( { ...state , scope : 'current' , depth : 'single' } )
3541 }
3642 />
3743 < SegmentedControlItem
3844 active = { state . scope === 'all' && state . depth === 'single' }
39- label = { withSiteVariants ? 'Most relevant' : 'Entire site' }
45+ label = {
46+ withSiteVariants
47+ ? tString ( language , 'search_scope_all_depth_single' )
48+ : tString ( language , 'search_scope_all_depth_full' )
49+ }
4050 icon = { withSiteVariants ? 'bullseye-arrow' : 'infinity' }
4151 onClick = { ( ) => setSearchState ( { ...state , scope : 'all' , depth : 'single' } ) }
4252 />
4353 { withSiteVariants ? (
4454 < SegmentedControlItem
4555 active = { state . scope === 'all' && state . depth === 'full' }
46- label = "Entire site"
56+ label = { tString ( language , 'search_scope_all_depth_full' ) }
4757 icon = "infinity"
4858 onClick = { ( ) =>
4959 setSearchState ( { ...state , scope : 'all' , depth : 'full' } )
@@ -58,16 +68,16 @@ export function SearchScopeToggle(props: {
5868 size = { state . scope === 'current' ? 'small' : 'medium' }
5969 active = { state . depth === 'single' }
6070 className = "py-1"
61- label = { spaceTitle }
62- icon = "crosshairs"
71+ label = { tString ( language , 'search_scope_current_depth_single' , spaceTitle ) }
72+ // icon="crosshairs"
6373 onClick = { ( ) => setSearchState ( { ...state , depth : 'single' } ) }
6474 />
6575 < SegmentedControlItem
6676 size = { state . scope === 'current' ? 'small' : 'medium' }
6777 active = { state . depth === 'full' }
6878 className = "py-1"
69- label = "All content"
70- icon = "rectangle-vertical-history"
79+ label = { tString ( language , 'search_scope_current_depth_full' , section ?. title ) }
80+ // icon="rectangle-vertical-history"
7181 onClick = { ( ) => setSearchState ( { ...state , depth : 'full' } ) }
7282 />
7383 </ SegmentedControl >
0 commit comments