Skip to content

Commit

Permalink
add translation link
Browse files Browse the repository at this point in the history
  • Loading branch information
hyansuper committed Jul 13, 2024
1 parent 5d52f78 commit 242a5e6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/manual/en/_static/custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
addEventListener("load", ev =>{
var url = location.href;
var el = document.getElementsByTagName('h1')[0];
var insert = document.createElement('p');
insert.style['text-indent'] = 0;
insert.innerHTML = url.indexOf('/en/')>=0 ?
`<a href="${url.replace('/en/','/zh-cn/')}">[中文]</a>` :
`<a href="${url.replace('/zh-cn/','/en/')}">[English]</a>`;
el.parentNode.insertBefore(insert, el.nextSibling);
});
1 change: 1 addition & 0 deletions docs/manual/en/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
html_static_path = ['_static']

html_css_files = ['custom.css']
html_js_files = ['custom.js']

html_theme_options = {
'collapse_navigation': False
Expand Down
10 changes: 10 additions & 0 deletions docs/manual/zh-cn/_static/custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
addEventListener("load", ev =>{
var url = location.href;
var el = document.getElementsByTagName('h1')[0];
var insert = document.createElement('p');
insert.style['text-indent'] = 0;
insert.innerHTML = url.indexOf('/en/')>=0 ?
`<a href="${url.replace('/en/','/zh-cn/')}">[中文]</a>` :
`<a href="${url.replace('/zh-cn/','/en/')}">[English]</a>`;
el.parentNode.insertBefore(insert, el.nextSibling);
});
1 change: 1 addition & 0 deletions docs/manual/zh-cn/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
html_static_path = ['_static']

html_css_files = ['custom.css']
html_js_files = ['custom.js']

html_theme_options = {
'collapse_navigation': False
Expand Down

0 comments on commit 242a5e6

Please sign in to comment.