Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
计算机应用开发
前端
Vuepress
提交
4480568a
V
Vuepress
项目概览
计算机应用开发
/
前端
/
Vuepress
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vuepress
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4480568a
编写于
4月 18, 2018
作者:
E
Evan You
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: langs -> locales
上级
6f5bac08
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
23 deletion
+24
-23
docs/.vuepress/config.js
docs/.vuepress/config.js
+1
-1
lib/app/dataMixin.js
lib/app/dataMixin.js
+12
-12
lib/default-theme/NavLinks.vue
lib/default-theme/NavLinks.vue
+6
-5
lib/default-theme/SearchBox.vue
lib/default-theme/SearchBox.vue
+4
-4
lib/prepare.js
lib/prepare.js
+1
-1
未找到文件。
docs/.vuepress/config.js
浏览文件 @
4480568a
module
.
exports
=
{
dest
:
'
vuepress
'
,
l
ang
s
:
{
l
ocale
s
:
{
'
/
'
:
{
lang
:
'
en-US
'
,
label
:
'
English
'
,
...
...
lib/app/dataMixin.js
浏览文件 @
4480568a
...
...
@@ -8,9 +8,9 @@ function prepare (siteData) {
page
.
frontmatter
=
{}
}
})
if
(
siteData
.
l
ang
s
)
{
Object
.
keys
(
siteData
.
l
ang
s
).
forEach
(
path
=>
{
siteData
.
l
ang
s
[
path
].
path
=
path
if
(
siteData
.
l
ocale
s
)
{
Object
.
keys
(
siteData
.
l
ocale
s
).
forEach
(
path
=>
{
siteData
.
l
ocale
s
[
path
].
path
=
path
})
}
Object
.
freeze
(
siteData
)
...
...
@@ -33,30 +33,30 @@ export default {
$site
()
{
return
store
.
siteData
},
$l
ang
Config
()
{
const
{
l
ang
s
}
=
this
.
$site
$l
ocale
Config
()
{
const
{
l
ocale
s
}
=
this
.
$site
let
targetLang
let
defaultLang
Object
.
keys
(
l
ang
s
).
forEach
(
path
=>
{
Object
.
keys
(
l
ocale
s
).
forEach
(
path
=>
{
if
(
path
===
'
/
'
)
{
defaultLang
=
l
ang
s
[
path
]
defaultLang
=
l
ocale
s
[
path
]
}
else
if
(
this
.
$page
.
path
.
indexOf
(
path
)
===
0
)
{
targetLang
=
l
ang
s
[
path
]
targetLang
=
l
ocale
s
[
path
]
}
})
return
targetLang
||
defaultLang
||
{}
},
$title
()
{
return
this
.
$l
ang
Config
.
title
||
this
.
$site
.
title
||
''
return
this
.
$l
ocale
Config
.
title
||
this
.
$site
.
title
||
''
},
$description
()
{
return
this
.
$l
ang
Config
.
description
||
this
.
$site
.
description
||
''
return
this
.
$l
ocale
Config
.
description
||
this
.
$site
.
description
||
''
},
$lang
()
{
return
this
.
$l
ang
Config
.
lang
||
'
en-US
'
return
this
.
$l
ocale
Config
.
lang
||
'
en-US
'
},
$localePath
()
{
return
this
.
$l
ang
Config
.
path
||
'
/
'
return
this
.
$l
ocale
Config
.
path
||
'
/
'
},
$page
()
{
return
findPageForPath
(
...
...
lib/default-theme/NavLinks.vue
浏览文件 @
4480568a
...
...
@@ -36,13 +36,14 @@ export default {
return
[]
},
nav
()
{
if
(
this
.
$site
.
langs
)
{
const
{
locales
}
=
this
.
$site
if
(
locales
)
{
let
currentLink
=
this
.
$page
.
path
const
routes
=
this
.
$router
.
options
.
routes
const
languageDropdown
=
{
text
:
this
.
$l
ang
Config
.
selectText
,
items
:
Object
.
keys
(
this
.
$site
.
lang
s
).
map
(
path
=>
{
const
locale
=
this
.
$site
.
lang
s
[
path
]
text
:
this
.
$l
ocale
Config
.
selectText
,
items
:
Object
.
keys
(
locale
s
).
map
(
path
=>
{
const
locale
=
locale
s
[
path
]
const
text
=
locale
.
label
let
link
// Stay on the current page
...
...
@@ -50,7 +51,7 @@ export default {
link
=
currentLink
}
else
{
// Try to stay on the same page
link
=
currentLink
.
replace
(
this
.
$l
ang
Config
.
path
,
path
)
link
=
currentLink
.
replace
(
this
.
$l
ocale
Config
.
path
,
path
)
// fallback to homepage
if
(
!
routes
.
some
(
route
=>
route
.
path
===
link
))
{
link
=
path
...
...
lib/default-theme/SearchBox.vue
浏览文件 @
4480568a
...
...
@@ -92,11 +92,11 @@ export default {
},
methods
:
{
getPageLocalePath
(
page
)
{
const
{
l
ang
s
}
=
this
.
$site
for
(
let
i
=
0
;
i
<
l
ang
s
.
length
;
i
++
)
{
const
localePath
=
l
ang
s
[
i
].
path
const
{
l
ocale
s
}
=
this
.
$site
for
(
let
i
=
0
;
i
<
l
ocale
s
.
length
;
i
++
)
{
const
localePath
=
l
ocale
s
[
i
].
path
if
(
localePath
!==
'
/
'
&&
page
.
path
.
indexOf
(
localePath
)
===
0
)
{
return
l
ang
s
[
i
].
path
return
l
ocale
s
[
i
].
path
}
}
return
'
/
'
...
...
lib/prepare.js
浏览文件 @
4480568a
...
...
@@ -188,7 +188,7 @@ async function resolveOptions (sourceDir) {
base
:
siteConfig
.
base
||
'
/
'
,
pages
:
pagesData
,
themeConfig
:
siteConfig
.
themeConfig
||
{},
l
angs
:
siteConfig
.
lang
s
l
ocales
:
siteConfig
.
locale
s
}
return
options
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录