File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1
1
import type { DefaultTheme } from "vitepress/types"
2
+ import { Locale } from "./types"
2
3
3
4
export function projectSidebar (
4
- projectIndex : string
5
+ projectIndex : string ,
6
+ locale ?: Locale
5
7
) : DefaultTheme . SidebarItem [ ] {
8
+ const langTag = locale && locale != Locale . EN_GB ? `/${ locale } ` : ""
6
9
return [
7
- { text : "Intro" , link : `/projects/${ projectIndex } /` } ,
8
- { text : "Usage" , link : `/projects/${ projectIndex } /usage` } ,
9
- { text : "API" , link : `/projects/${ projectIndex } /api` } ,
10
- { text : "Changelog" , link : `/projects/${ projectIndex } /changelog` } ,
10
+ { text : "Intro" , link : `${ langTag } /projects/${ projectIndex } /` } ,
11
+ { text : "Usage" , link : `${ langTag } /projects/${ projectIndex } /usage` } ,
12
+ { text : "API" , link : `${ langTag } /projects/${ projectIndex } /api` } ,
13
+ {
14
+ text : "Changelog" ,
15
+ link : `${ langTag } /projects/${ projectIndex } /changelog` ,
16
+ } ,
11
17
]
12
18
}
Original file line number Diff line number Diff line change
1
+ export enum Locale {
2
+ EN_GB = "en-GB" ,
3
+ ZH_CN = "zh-CN"
4
+ }
You can’t perform that action at this time.
0 commit comments