@@ -16,6 +16,7 @@ import {
1616} from '@/views/settings/types/messages'
1717import { GeneralSection } from './sections/GeneralSection'
1818import { PresetsSection } from './sections/PresetsSection'
19+ import { use_translation , TranslationKey } from '@/i18n/use-translation'
1920
2021type NavItem =
2122 | 'general'
@@ -27,30 +28,42 @@ type NavItem =
2728 | 'commit-messages'
2829
2930type NavConfigItem =
30- | { type : 'item' ; id : NavItem ; label : string }
31- | { type : 'divider' ; text ?: string }
31+ | { type : 'item' ; id : NavItem ; label : TranslationKey }
32+ | { type : 'divider' ; text ?: TranslationKey }
3233
3334const NAV_ITEMS_CONFIG : NavConfigItem [ ] = [
3435 {
3536 type : 'item' ,
3637 id : 'general' ,
37- label : 'General '
38+ label : 'settings.sidebar.general '
3839 } ,
3940 {
4041 type : 'item' ,
4142 id : 'presets' ,
42- label : 'Presets '
43+ label : 'settings.sidebar.presets '
4344 } ,
4445 {
4546 type : 'item' ,
4647 id : 'model-providers' ,
47- label : 'Model Providers '
48+ label : 'settings.sidebar.model-providers '
4849 } ,
49- { type : 'divider' , text : 'API Tools' } ,
50- { type : 'item' , id : 'edit-context' , label : 'Edit Context' } ,
51- { type : 'item' , id : 'code-completions' , label : 'Code Completions' } ,
52- { type : 'item' , id : 'intelligent-update' , label : 'Intelligent Update' } ,
53- { type : 'item' , id : 'commit-messages' , label : 'Commit Messages' }
50+ { type : 'divider' , text : 'settings.sidebar.api-tools' } ,
51+ { type : 'item' , id : 'edit-context' , label : 'settings.sidebar.edit-context' } ,
52+ {
53+ type : 'item' ,
54+ id : 'code-completions' ,
55+ label : 'settings.sidebar.code-completions'
56+ } ,
57+ {
58+ type : 'item' ,
59+ id : 'intelligent-update' ,
60+ label : 'settings.sidebar.intelligent-update'
61+ } ,
62+ {
63+ type : 'item' ,
64+ id : 'commit-messages' ,
65+ label : 'settings.sidebar.commit-messages'
66+ }
5467]
5568
5669type Props = {
@@ -106,6 +119,8 @@ type Props = {
106119}
107120
108121export const Home : React . FC < Props > = ( props ) => {
122+ const { t } = use_translation ( )
123+
109124 const scroll_container_ref = useRef < HTMLDivElement > ( null )
110125 const section_refs = useRef < Record < NavItem , HTMLDivElement | null > > ( {
111126 general : null ,
@@ -241,17 +256,22 @@ export const Home: React.FC<Props> = (props) => {
241256 < div style = { { height : '100vh' } } >
242257 < Layout
243258 ref = { scroll_container_ref }
244- title = "Settings"
259+ title = { t ( 'settings.sidebar.settings' ) }
245260 sidebar = { NAV_ITEMS_CONFIG . map ( ( item , i ) => {
246261 if ( item . type == 'divider' ) {
247- return < NavigationDivider key = { i } text = { item . text } />
262+ return (
263+ < NavigationDivider
264+ key = { i }
265+ text = { item . text ? t ( item . text ) : undefined }
266+ />
267+ )
248268 }
249269
250270 return (
251271 < NavigationItem
252272 key = { i }
253273 href = { `#${ item . id } ` }
254- label = { item . label }
274+ label = { t ( item . label ) }
255275 is_active = { item . id === active_nav_item_id }
256276 on_click = { ( e ) => handle_nav_click ( e , item . id ) }
257277 />
0 commit comments