Skip to content

Commit 5bd91b4

Browse files
Merge pull request #1488 from docsifyjs/update-language-support
fix: Update language support
2 parents f1f8121 + 2626036 commit 5bd91b4

File tree

4 files changed

+129
-100
lines changed

4 files changed

+129
-100
lines changed

docs/_navbar.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
- [:uk: English](/)
33
- [:cn: 中文](/zh-cn/)
44
- [:de: Deutsch](/de-de/)
5-
- [:es: Spanish](/es/)
6-
- [:ru: Russian](/ru-ru/)
5+
- [:es: Español](/es/)
6+
- [:ru: Русский](/ru-ru/)

docs/index.html

+16-6
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,29 @@
5656
<body>
5757
<div id="app">Loading ...</div>
5858
<script>
59+
// Set html "lang" attribute based on URL
60+
var lang = location.hash.match(/#\/(de-de|es|ru-ru|zh-cn)\//);
61+
62+
if (lang) {
63+
document.documentElement.setAttribute('lang', lang[1]);
64+
}
65+
66+
// Docsify configuration
5967
window.$docsify = {
6068
alias: {
6169
'.*?/awesome':
6270
'https://raw.githubusercontent.com/docsifyjs/awesome-docsify/master/README.md',
6371
'.*?/changelog':
6472
'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG.md',
6573
'/.*/_navbar.md': '/_navbar.md',
66-
'/zh-cn/(.*)':
67-
'https://raw.githubusercontent.com/docsifyjs/docs-zh/master/$1',
74+
'/es/(.*)':
75+
'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1',
6876
'/de-de/(.*)':
6977
'https://raw.githubusercontent.com/docsifyjs/docs-de/master/$1',
7078
'/ru-ru/(.*)':
7179
'https://raw.githubusercontent.com/docsifyjs/docs-ru/master/$1',
72-
'/es/(.*)':
73-
'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1',
74-
'/write-a-plugin':
75-
'https://raw.githubusercontent.com/docsifyjs/docsify/master/docs/write-a-plugin.md',
80+
'/zh-cn/(.*)':
81+
'https://cdn.jsdelivr.net/gh/docsifyjs/docs-zh@master/$1',
7682
},
7783
auto2top: true,
7884
coverpage: true,
@@ -90,13 +96,17 @@
9096
name: 'docsify',
9197
search: {
9298
noData: {
99+
'/es/': '¡No hay resultados!',
93100
'/de-de/': 'Keine Ergebnisse!',
101+
'/ru-ru/': 'Никаких результатов!',
94102
'/zh-cn/': '没有结果!',
95103
'/': 'No results!',
96104
},
97105
paths: 'auto',
98106
placeholder: {
107+
'/es/': 'Buscar',
99108
'/de-de/': 'Suche',
109+
'/ru-ru/': 'Поиск',
100110
'/zh-cn/': '搜索',
101111
'/': 'Search',
102112
},

index.html

+110-91
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,118 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>docsify</title>
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7+
<meta name="viewport" content="width=device-width,initial-scale=1" />
8+
<link rel="stylesheet" href="/themes/vue.css" title="vue" />
9+
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled />
10+
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled />
11+
<link rel="stylesheet" href="/themes/pure.css" title="pure" disabled />
12+
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1.0.1/index.min.js"></script>
13+
<style>
14+
nav.app-nav li ul {
15+
min-width: 100px;
16+
}
317

4-
<head>
5-
<meta charset="UTF-8">
6-
<title>docsify</title>
7-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8-
<meta name="viewport" content="width=device-width,initial-scale=1">
9-
<link rel="stylesheet" href="/themes/vue.css" title="vue">
10-
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled>
11-
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled>
12-
<link rel="stylesheet" href="/themes/pure.css" title="pure" disabled>
13-
<script src="//cdn.jsdelivr.net/npm/docsify-plugin-carbon@1.0.1/index.min.js"></script>
14-
<style>
15-
nav.app-nav li ul {
16-
min-width: 100px;
17-
}
18+
#carbonads {
19+
box-shadow: none !important;
20+
width: auto !important;
21+
}
22+
</style>
23+
</head>
1824

19-
#carbonads {
20-
box-shadow: none !important;
21-
width: auto !important;
22-
}
23-
</style>
24-
</head>
25+
<body>
26+
<div id="app"></div>
27+
<script>
28+
// Set html "lang" attribute based on URL
29+
var lang = location.hash.match(/#\/(de-de|es|ru-ru|zh-cn)\//);
2530

26-
<body>
27-
<div id="app"></div>
28-
<script>
29-
window.$docsify = {
30-
alias: {
31-
'.*?/awesome': 'https://raw.githubusercontent.com/docsifyjs/awesome-docsify/master/README.md',
32-
'.*?/changelog': 'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG.md',
33-
'/.*/_navbar.md': '/_navbar.md',
34-
'/zh-cn/(.*)': 'https://cdn.jsdelivr.net/gh/docsifyjs/docs-zh@master/$1',
35-
'/de-de/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-de/master/$1',
36-
'/ru-ru/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-ru/master/$1',
37-
'/es/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1',
38-
'/write-a-plugin': 'https://raw.githubusercontent.com/docsifyjs/docsify/master/docs/write-a-plugin.md'
39-
},
40-
auto2top: true,
41-
basePath: '/docs/',
42-
coverpage: true,
43-
executeScript: true,
44-
loadSidebar: true,
45-
loadNavbar: true,
46-
mergeNavbar: true,
47-
maxLevel: 4,
48-
subMaxLevel: 2,
49-
name: 'docsify',
50-
search: {
51-
noData: {
52-
'/de-de/': 'Keine Ergebnisse!',
53-
'/zh-cn/': '没有结果!',
54-
'/': 'No results!'
55-
},
56-
paths: 'auto',
57-
placeholder: {
58-
'/de-de/': 'Suche',
59-
'/zh-cn/': '搜索',
60-
'/': 'Search'
31+
if (lang) {
32+
document.documentElement.setAttribute('lang', lang[1]);
33+
}
34+
35+
// Docsify configuration
36+
window.$docsify = {
37+
alias: {
38+
'.*?/awesome':
39+
'https://raw.githubusercontent.com/docsifyjs/awesome-docsify/master/README.md',
40+
'.*?/changelog':
41+
'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG.md',
42+
'/.*/_navbar.md': '/_navbar.md',
43+
'/es/(.*)':
44+
'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1',
45+
'/de-de/(.*)':
46+
'https://raw.githubusercontent.com/docsifyjs/docs-de/master/$1',
47+
'/ru-ru/(.*)':
48+
'https://raw.githubusercontent.com/docsifyjs/docs-ru/master/$1',
49+
'/zh-cn/(.*)':
50+
'https://cdn.jsdelivr.net/gh/docsifyjs/docs-zh@master/$1',
6151
},
62-
pathNamespaces: ['/zh-cn', '/de-de', '/ru-ru', '/es']
63-
},
64-
plugins: [
65-
DocsifyCarbon.create('CEBI6KQE', 'docsifyjsorg'),
66-
function (hook, vm) {
67-
hook.beforeEach(function (html) {
68-
if (/githubusercontent\.com/.test(vm.route.file)) {
69-
url = vm.route.file
70-
.replace('raw.githubusercontent.com', 'github.com')
71-
.replace(/\/master/, '/blob/master')
72-
} else if (/jsdelivr\.net/.test(vm.route.file)) {
73-
url = vm.route.file
74-
.replace('cdn.jsdelivr.net/gh', 'github.com')
75-
.replace('@master', '/blob/master')
76-
} else {
77-
url = 'https://github.com/docsifyjs/docsify/blob/master/docs/' + vm.route.file
78-
}
79-
var editHtml = '[:memo: Edit Document](' + url + ')\n'
80-
return editHtml
81-
+ html
82-
+ '\n\n----\n\n'
83-
+ '<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>'
84-
})
52+
auto2top: true,
53+
basePath: '/docs/',
54+
coverpage: true,
55+
executeScript: true,
56+
loadSidebar: true,
57+
loadNavbar: true,
58+
mergeNavbar: true,
59+
maxLevel: 4,
60+
subMaxLevel: 2,
61+
name: 'docsify',
62+
search: {
63+
noData: {
64+
'/es/': '¡No hay resultados!',
65+
'/de-de/': 'Keine Ergebnisse!',
66+
'/ru-ru/': 'Никаких результатов!',
67+
'/zh-cn/': '没有结果!',
68+
'/': 'No results!',
69+
},
70+
paths: 'auto',
71+
placeholder: {
72+
'/es/': 'Buscar',
73+
'/de-de/': 'Suche',
74+
'/ru-ru/': 'Поиск',
75+
'/zh-cn/': '搜索',
76+
'/': 'Search',
77+
},
78+
pathNamespaces: ['/es', '/de-de', '/ru-ru', '/zh-cn']
8579
},
86-
]
87-
}
88-
</script>
89-
<script src="/lib/docsify.js"></script>
90-
<script src="/lib/plugins/search.js"></script>
91-
<script src="/lib/plugins/emoji.js"></script>
92-
<script src="/lib/plugins/front-matter.js"></script>
93-
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-bash.min.js"></script>
94-
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-markdown.min.js"></script>
95-
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-nginx.min.js"></script>
96-
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-php.min.js"></script>
97-
</body>
98-
80+
plugins: [
81+
DocsifyCarbon.create('CEBI6KQE', 'docsifyjsorg'),
82+
function(hook, vm) {
83+
hook.beforeEach(function(html) {
84+
if (/githubusercontent\.com/.test(vm.route.file)) {
85+
url = vm.route.file
86+
.replace('raw.githubusercontent.com', 'github.com')
87+
.replace(/\/master/, '/blob/master');
88+
} else if (/jsdelivr\.net/.test(vm.route.file)) {
89+
url = vm.route.file
90+
.replace('cdn.jsdelivr.net/gh', 'github.com')
91+
.replace('@master', '/blob/master');
92+
} else {
93+
url =
94+
'https://github.com/docsifyjs/docsify/blob/master/docs/' +
95+
vm.route.file;
96+
}
97+
var editHtml = '[:memo: Edit Document](' + url + ')\n';
98+
return (
99+
editHtml +
100+
html +
101+
'\n\n----\n\n' +
102+
'<a href="https://docsify.js.org" target="_blank" style="color: inherit; font-weight: normal; text-decoration: none;">Powered by docsify</a>'
103+
);
104+
});
105+
},
106+
],
107+
};
108+
</script>
109+
<script src="/lib/docsify.js"></script>
110+
<script src="/lib/plugins/search.js"></script>
111+
<script src="/lib/plugins/emoji.js"></script>
112+
<script src="/lib/plugins/front-matter.js"></script>
113+
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-bash.min.js"></script>
114+
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-markdown.min.js"></script>
115+
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-nginx.min.js"></script>
116+
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-php.min.js"></script>
117+
</body>
99118
</html>

test/integration/__snapshots__/docs.test.js.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ exports[`Docs Site coverpage renders and is unchanged 1`] = `
77
<a href=\\"#/?id=docsify\\">Getting Started</a></p></div></section>"
88
`;
99
10-
exports[`Docs Site navbar renders and is unchanged 1`] = `"<nav class=\\"app-nav no-badge\\"><ul><li>Translations<ul><li><a href=\\"#/\\" title=\\"undefined\\" class=\\"active\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/uk.png\\" alt=\\"uk\\"> English</a></li><li><a href=\\"#/zh-cn/\\" title=\\"undefined\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/cn.png\\" alt=\\"cn\\"> 中文</a></li><li><a href=\\"#/de-de/\\" title=\\"undefined\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/de.png\\" alt=\\"de\\"> Deutsch</a></li><li><a href=\\"#/es/\\" title=\\"undefined\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/es.png\\" alt=\\"es\\"> Spanish</a></li><li><a href=\\"#/ru-ru/\\" title=\\"undefined\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/ru.png\\" alt=\\"ru\\"> Russian</a></li></ul></li></ul></nav>"`;
10+
exports[`Docs Site navbar renders and is unchanged 1`] = `"<nav class=\\"app-nav no-badge\\"><ul><li>Translations<ul><li><a href=\\"#/\\" title=\\"undefined\\" class=\\"active\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/uk.png\\" alt=\\"uk\\"> English</a></li><li><a href=\\"#/zh-cn/\\" title=\\"undefined\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/cn.png\\" alt=\\"cn\\"> 中文</a></li><li><a href=\\"#/de-de/\\" title=\\"undefined\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/de.png\\" alt=\\"de\\"> Deutsch</a></li><li><a href=\\"#/es/\\" title=\\"undefined\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/es.png\\" alt=\\"es\\"> Español</a></li><li><a href=\\"#/ru-ru/\\" title=\\"undefined\\"><img class=\\"emoji\\" src=\\"https://github.githubassets.com/images/icons/emoji/ru.png\\" alt=\\"ru\\"> Русский</a></li></ul></li></ul></nav>"`;
1111
1212
exports[`Docs Site sidebar renders and is unchanged 1`] = `"<aside class=\\"sidebar\\"><div class=\\"sidebar-nav\\"><ul><li><p>Getting started</p><ul><li><a href=\\"#/quickstart\\" title=\\"undefined\\">Quick start</a></li><li><a href=\\"#/more-pages\\" title=\\"undefined\\">Writing more pages</a></li><li><a href=\\"#/custom-navbar\\" title=\\"undefined\\">Custom navbar</a></li><li><a href=\\"#/cover\\" title=\\"undefined\\">Cover page</a></li></ul></li><li><p>Customization</p><ul><li><a href=\\"#/configuration\\" title=\\"undefined\\">Configuration</a></li><li><a href=\\"#/themes\\" title=\\"undefined\\">Themes</a></li><li><a href=\\"#/plugins\\" title=\\"undefined\\">List of Plugins</a></li><li><a href=\\"#/write-a-plugin\\" title=\\"undefined\\">Write a Plugin</a></li><li><a href=\\"#/markdown\\" title=\\"undefined\\">Markdown configuration</a></li><li><a href=\\"#/language-highlight\\" title=\\"undefined\\">Language highlighting</a></li></ul></li><li><p>Guide</p><ul><li><a href=\\"#/deploy\\" title=\\"undefined\\">Deploy</a></li><li><a href=\\"#/helpers\\" title=\\"undefined\\">Helpers</a></li><li><a href=\\"#/vue\\" title=\\"undefined\\">Vue compatibility</a></li><li><a href=\\"#/cdn\\" title=\\"undefined\\">CDN</a></li><li><a href=\\"#/pwa\\" title=\\"undefined\\">Offline Mode(PWA)</a></li><li><a href=\\"#/ssr\\" title=\\"undefined\\">Server-Side Rendering(SSR)</a></li><li><a href=\\"#/embed-files\\" title=\\"undefined\\">Embed Files</a></li></ul></li><li><p><a href=\\"#/awesome\\" title=\\"undefined\\">Awesome docsify</a></p></li><li><p><a href=\\"#/changelog\\" title=\\"undefined\\">Changelog</a></p></li></ul></div></aside>"`;

0 commit comments

Comments
 (0)