File tree Expand file tree Collapse file tree
apps/web/src/components/settings Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
142142 const [ compactSearchOpen , setCompactSearchOpen ] = useState ( false ) ;
143143 const [ activeResultIndex , setActiveResultIndex ] = useState ( 0 ) ;
144144 const searchableItems = useAvailableSettingsSearchItems ( ) ;
145- const results = searchSettings ( query , searchableItems ) ;
145+ const results = searchSettings ( query , searchableItems , m ) ;
146146 const isSearching = query . trim ( ) . length > 0 ;
147147 const hasResults = results . length > 0 ;
148148 const maxResultIndex = Math . max ( results . length - 1 , 0 ) ;
Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ describe("searchSettings", () => {
6464 expect ( searchSettings ( "sharing" , ITEMS ) . map ( ( item ) => item . id ) ) . toEqual ( [ "network-access" ] ) ;
6565 expect ( searchSettings ( "claude" , ITEMS ) . map ( ( item ) => item . id ) ) . toEqual ( [ "providers" ] ) ;
6666 expect ( searchSettings ( "long lines" , ITEMS ) . map ( ( item ) => item . id ) ) . toEqual ( [ "word-wrap" ] ) ;
67+ const spanish = ( message : string ) => ( message === "Word wrap" ? "Ajuste de línea" : message ) ;
68+ expect ( searchSettings ( "ajuste" , ITEMS , spanish ) . map ( ( item ) => item . id ) ) . toEqual ( [ "word-wrap" ] ) ;
6769 for ( const query of [ "fallback" , "fallback agent" , "fallback model" ] ) {
6870 expect ( searchSettings ( query ) [ 0 ] ) . toMatchObject ( {
6971 id : "fallback-model" ,
Original file line number Diff line number Diff line change @@ -1513,6 +1513,7 @@ export function settingsForThisPlatform(
15131513export function searchSettings (
15141514 query : string ,
15151515 items : ReadonlyArray < SettingsSearchItem > = SETTINGS_SEARCH_ITEMS ,
1516+ translate : ( message : string ) => string = ( message ) => message ,
15161517) : ReadonlyArray < SettingsSearchItem > {
15171518 const normalizedQuery = normalizeSearchText ( query ) ;
15181519 if ( normalizedQuery . length === 0 ) return [ ] ;
@@ -1524,6 +1525,9 @@ export function searchSettings(
15241525 const fields = [
15251526 title ,
15261527 normalizeSearchText ( SETTINGS_SECTION_LABELS [ item . to ] ) ,
1528+ // The labels as displayed, so search also works in the active language.
1529+ normalizeSearchText ( translate ( item . title ) ) ,
1530+ normalizeSearchText ( translate ( SETTINGS_SECTION_LABELS [ item . to ] ) ) ,
15271531 ...( item . searchTerms ?? [ ] ) . map ( normalizeSearchText ) ,
15281532 ] ;
15291533 if ( ! queryTokens . every ( ( token ) => fields . some ( ( field ) => field . includes ( token ) ) ) ) return [ ] ;
You can’t perform that action at this time.
0 commit comments