aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2019-11-10 00:23:06 +0100
committerAlex Shpak <alex-shpak@users.noreply.github.com>2019-11-16 20:35:23 +0100
commit05c3b8fac9bec7cf54fed20d93fac52e1e97ad97 (patch)
tree616345b1ec544000d9b3471852ac088bc8df382c
parent9cd378a2d27ad4c9cb2e46d12022e68e23f96ea7 (diff)
Add language switch at bottom of page
-rw-r--r--assets/_main.scss48
-rw-r--r--assets/_print.scss1
-rw-r--r--exampleSite/config.toml3
-rw-r--r--exampleSite/config.yaml3
-rw-r--r--exampleSite/i18n/en.yaml6
-rw-r--r--exampleSite/i18n/ru.yaml6
-rw-r--r--exampleSite/resources/_gen/assets/scss/book.scss_50fc8c04e12a2f59027287995557ceff.content2
-rw-r--r--exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.json1
-rw-r--r--i18n/cn.yaml5
-rw-r--r--i18n/en.yaml5
-rw-r--r--i18n/ru.yaml5
-rw-r--r--layouts/docs/baseof.html2
-rw-r--r--layouts/partials/docs/footer.html (renamed from layouts/partials/docs/git-footer.html)3
-rw-r--r--layouts/partials/docs/language-switch.html14
-rw-r--r--layouts/partials/docs/languages.html32
-rw-r--r--layouts/partials/docs/menu-filetree.html2
-rw-r--r--layouts/partials/docs/menu.html5
-rw-r--r--layouts/partials/docs/search.html2
-rw-r--r--layouts/partials/docs/translation-switch.html14
-rw-r--r--layouts/posts/baseof.html2
-rw-r--r--static/svg/translate.svg1
21 files changed, 110 insertions, 52 deletions
diff --git a/assets/_main.scss b/assets/_main.scss
index 3cfb66d..ce810dd 100644
--- a/assets/_main.scss
+++ b/assets/_main.scss
@@ -227,6 +227,54 @@ ul.pagination {
}
}
+
+.book-languages {
+ position: relative;
+ overflow: visible;
+
+ padding: $padding-16;
+ margin: -$padding-16;
+
+ &:hover .book-languages-list {
+ display: block;
+ }
+
+ .book-languages-list {
+ display: none;
+
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ padding: $padding-8 0;
+
+ background: $body-background;
+ box-shadow: 0 0 $padding-4 rgba(0, 0, 0, 0.1);
+
+ li {
+ padding: $padding-8 $padding-16;
+ white-space: nowrap;
+ }
+
+ img {
+ opacity: .1;
+ }
+
+ li.active img {
+ opacity: 1;
+ }
+
+ a {
+ color: inherit;
+ }
+ }
+
+ ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ }
+}
+
.book-posts {
min-width: $body-min-width;
max-width: $body-min-width * 2;
diff --git a/assets/_print.scss b/assets/_print.scss
index fca8312..387b4ff 100644
--- a/assets/_print.scss
+++ b/assets/_print.scss
@@ -1,4 +1,3 @@
-// Printing styles
@media print {
.book-menu,
.book-footer {
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index a255c7d..db2bb08 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -23,6 +23,9 @@ defaultContentLanguage = 'en'
[languages.ru]
languageName = 'Russian'
weight = 2
+ [languages.cn]
+ languageName = 'Chinese'
+ weight = 3
[params]
# (Optional, default 6) Set how many table of contents levels to be showed on page.
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index 5ed865e..720d5d3 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -23,6 +23,9 @@ languages:
ru:
languageName: Russian
weight: 2
+ cn:
+ languageName: Chinese
+ weight: 3
params:
# (Optional, default 6) Set how many table of contents levels to be showed on page.
diff --git a/exampleSite/i18n/en.yaml b/exampleSite/i18n/en.yaml
deleted file mode 100644
index 93b0488..0000000
--- a/exampleSite/i18n/en.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-# General
-- id: translations
- translation: Translations
-
-- id: languages
- translation: Languages \ No newline at end of file
diff --git a/exampleSite/i18n/ru.yaml b/exampleSite/i18n/ru.yaml
deleted file mode 100644
index 6584a39..0000000
--- a/exampleSite/i18n/ru.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-# General
-- id: translations
- translation: Переводы
-
-- id: languages
- translation: Языки \ No newline at end of file
diff --git a/exampleSite/resources/_gen/assets/scss/book.scss_50fc8c04e12a2f59027287995557ceff.content b/exampleSite/resources/_gen/assets/scss/book.scss_50fc8c04e12a2f59027287995557ceff.content
index c6e1644..6e28686 100644
--- a/exampleSite/resources/_gen/assets/scss/book.scss_50fc8c04e12a2f59027287995557ceff.content
+++ b/exampleSite/resources/_gen/assets/scss/book.scss_50fc8c04e12a2f59027287995557ceff.content
@@ -1 +1 @@
-/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:1 1 auto}.flex-even{flex:1 1}.flex-wrap{flex-wrap:wrap}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.hidden{display:none}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#05b}a:visited{color:#8440f1}img{vertical-align:baseline}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}.levels-1 ul ul,.levels-2 ul ul ul,.levels-3 ul ul ul ul,.levels-4 ul ul ul ul ul,.levels-5 ul ul ul ul ul ul,.levels-6 ul ul ul ul ul ul ul{display:none}ul.pagination{display:flex;justify-content:center;list-style-type:none}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-brand img{height:1.5em;width:auto;vertical-align:middle;margin-right:.5rem}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:inherit}.book-menu a.active{color:#05b}.book-section-flat{margin-bottom:2rem}.book-section-flat:not(:first-child){margin-top:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:bolder}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-search{position:relative;margin:1rem 0;border-bottom:1px solid transparent}.book-search::after{display:block;content:"";clear:both}.book-search input{width:100%;padding:.5rem;border:0;border-radius:.25rem;background:#f8f9fa;color:#343a40}.book-search input:required+.book-search-spinner{display:block}.book-search .book-search-spinner{position:absolute;margin:.5rem;right:0;top:0;width:1rem;height:1rem;border:1px solid transparent;border-top-color:#343a40;border-radius:50%;animation:spin 1s ease infinite}@keyframes spin{100%{transform:rotate(360deg)}}.book-toc{flex:0 0 16rem;font-size:.75rem}.book-toc nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc img{height:1em}.book-toc nav>ul>li:first-child{margin-top:0}.book-footer{display:flex;padding-top:1rem;font-size:.875rem}.book-footer img{height:1em;margin-right:.5rem}.book-posts{min-width:20rem;max-width:40rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}.book-home{padding:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:57rem){.book-toc{display:none}}@media screen and (max-width:36rem){.book-menu{margin-left:-16rem;font-size:16px}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:italic;font-weight:300;src:local("Roboto Light Italic"),local(Roboto-LightItalic),url(fonts/roboto-v19-latin-300italic.woff2) format("woff2"),url(fonts/roboto-v19-latin-300italic.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:400;src:local(Roboto),local(Roboto-Regular),url(fonts/roboto-v19-latin-regular.woff2) format("woff2"),url(fonts/roboto-v19-latin-regular.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;src:local("Roboto Bold"),local(Roboto-Bold),url(fonts/roboto-v19-latin-700.woff2) format("woff2"),url(fonts/roboto-v19-latin-700.woff) format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local(RobotoMono-Regular),url(fonts/roboto-mono-v6-latin-regular.woff2) format("woff2"),url(fonts/roboto-mono-v6-latin-regular.woff) format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace}@media print{.book-menu,.book-footer{display:none}main{flex-direction:column-reverse}.book-toc{flex:none}.book-toc nav{position:relative;width:auto}}.markdown{line-height:1.6em}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1em;margin-top:1.5em;margin-bottom:1rem}.markdown>:first-child{margin-top:0}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown img{max-width:100%}.markdown code{padding:0 .25rem;background:#e9ecef;border-radius:.15rem;font-size:.875em}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{margin:1rem 0;padding:.5rem 1rem .5rem .75rem;border-left:.25rem solid #e9ecef;border-radius:.15rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{overflow:auto;display:block;border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.markdown hr{height:1px;border:none;background:#e9ecef}.markdown ul,.markdown ol{padding-left:2rem}.markdown dl dt{font-weight:bolder;margin-top:1rem}.markdown dl dd{margin-left:2rem}.markdown .highlight table tr td:nth-child(1) pre{margin:0;padding-right:0}.markdown .highlight table tr td:nth-child(2) pre{margin:0;padding-left:0}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.book-expand{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden}.book-expand .book-expand-head{background:#f8f9fa;padding:.5rem 1rem;cursor:pointer}.book-expand .book-expand-content{display:none;padding:1rem}.book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.book-tabs{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden;display:flex;flex-wrap:wrap}.book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid #f8f9fa;padding:1rem;display:none}.book-tabs input[type=radio]:checked+label{border-bottom:1px solid #05b}.book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.book-columns{margin-left:-1rem;margin-right:-1rem}.book-columns>div{margin:1rem 0;min-width:13.2rem;padding:0 1rem}a.book-btn{display:inline-block;color:#05b!important;text-decoration:none!important;border:1px solid #05b;border-radius:.15rem;padding:.25rem 1rem;margin-top:.5rem;margin-bottom:.5rem;cursor:pointer}.book-hint.info{border-left-color:#6bf;background-color:rgba(102,187,255,.1)}.book-hint.warning{border-left-color:#fd6;background-color:rgba(255,221,102,.1)}.book-hint.danger{border-left-color:#f66;background-color:rgba(255,102,102,.1)} \ No newline at end of file
+/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:1 1 auto}.flex-even{flex:1 1}.flex-wrap{flex-wrap:wrap}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.hidden{display:none}html{font-size:16px;letter-spacing:.33px;scroll-behavior:smooth}html,body{min-width:20rem;overflow-x:hidden}body{color:#343a40;background:#fff;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:#05b}a:visited{color:#8440f1}img{vertical-align:baseline}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-left:1rem}.levels-1 ul ul,.levels-2 ul ul ul,.levels-3 ul ul ul ul,.levels-4 ul ul ul ul ul,.levels-5 ul ul ul ul ul ul,.levels-6 ul ul ul ul ul ul ul{display:none}ul.pagination{display:flex;justify-content:center;list-style-type:none}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-brand{margin-top:0}.book-brand img{height:1.5em;width:auto;vertical-align:middle;margin-right:.5rem}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a{color:inherit}.book-menu a.active{color:#05b}.book-section-flat{margin-bottom:2rem}.book-section-flat:not(:first-child){margin-top:2rem}.book-section-flat>a,.book-section-flat>span{font-weight:bolder}.book-section-flat>ul{padding-left:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-header{margin-bottom:1rem;display:none}.book-search{position:relative;margin:1rem 0;border-bottom:1px solid transparent}.book-search::after{display:block;content:"";clear:both}.book-search input{width:100%;padding:.5rem;border:0;border-radius:.25rem;background:#f8f9fa;color:#343a40}.book-search input:required+.book-search-spinner{display:block}.book-search .book-search-spinner{position:absolute;margin:.5rem;right:0;top:0;width:1rem;height:1rem;border:1px solid transparent;border-top-color:#343a40;border-radius:50%;animation:spin 1s ease infinite}@keyframes spin{100%{transform:rotate(360deg)}}.book-toc{flex:0 0 16rem;font-size:.75rem}.book-toc nav{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc img{height:1em}.book-toc nav>ul>li:first-child{margin-top:0}.book-footer{display:flex;padding-top:1rem;font-size:.875rem}.book-footer img{height:1em;margin-right:.5rem}.book-posts{min-width:20rem;max-width:40rem;flex-grow:1;padding:1rem}.book-posts article{padding-bottom:1rem}.book-home{padding:1rem}aside nav,.book-page,.book-posts,.markdown{transition:.2s ease-in-out;transition-property:transform,margin-left,opacity;will-change:transform,margin-left}@media screen and (max-width:57rem){.book-toc{display:none}}@media screen and (max-width:36rem){.book-menu{margin-left:-16rem;font-size:16px}.book-header{display:flex}#menu-control:checked+main .book-menu nav,#menu-control:checked+main .book-page,#menu-control:checked+main .book-posts{transform:translateX(16rem)}#menu-control:checked+main .book-header label{transform:rotate(90deg)}#menu-control:checked+main .markdown{opacity:.25}}@media screen and (min-width:80rem){.book-page,.book-posts,.book-menu nav,.book-toc nav{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:italic;font-weight:300;src:local("Roboto Light Italic"),local(Roboto-LightItalic),url(fonts/roboto-v19-latin-300italic.woff2) format("woff2"),url(fonts/roboto-v19-latin-300italic.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:400;src:local(Roboto),local(Roboto-Regular),url(fonts/roboto-v19-latin-regular.woff2) format("woff2"),url(fonts/roboto-v19-latin-regular.woff) format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;src:local("Roboto Bold"),local(Roboto-Bold),url(fonts/roboto-v19-latin-700.woff2) format("woff2"),url(fonts/roboto-v19-latin-700.woff) format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;src:local("Roboto Mono"),local(RobotoMono-Regular),url(fonts/roboto-mono-v6-latin-regular.woff2) format("woff2"),url(fonts/roboto-mono-v6-latin-regular.woff) format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace}@media print{.book-menu,.book-footer{display:none}main{flex-direction:column-reverse}.book-toc{flex:none}.book-toc nav{position:relative;width:auto}}.markdown{line-height:1.6em}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5{font-weight:400;line-height:1em;margin-top:1.5em;margin-bottom:1rem}.markdown>:first-child{margin-top:0}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown img{max-width:100%}.markdown code{padding:0 .25rem;background:#e9ecef;border-radius:.15rem;font-size:.875em}.markdown pre{padding:1rem;background:#f8f9fa;border-radius:.15rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown blockquote{margin:1rem 0;padding:.5rem 1rem .5rem .75rem;border-left:.25rem solid #e9ecef;border-radius:.15rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{overflow:auto;display:block;border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;border:1px solid #e9ecef}.markdown table tr:nth-child(2n){background:#f8f9fa}.markdown hr{height:1px;border:none;background:#e9ecef}.markdown ul,.markdown ol{padding-left:2rem}.markdown dl dt{font-weight:bolder;margin-top:1rem}.markdown dl dd{margin-left:2rem}.markdown .highlight table tr td:nth-child(1) pre{margin:0;padding-right:0}.markdown .highlight table tr td:nth-child(2) pre{margin:0;padding-left:0}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.book-expand{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden}.book-expand .book-expand-head{background:#f8f9fa;padding:.5rem 1rem;cursor:pointer}.book-expand .book-expand-content{display:none;padding:1rem}.book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.book-tabs{margin-top:1rem;margin-bottom:1rem;border:1px solid #e9ecef;border-radius:.15rem;overflow:hidden;display:flex;flex-wrap:wrap}.book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid #f8f9fa;padding:1rem;display:none}.book-tabs input[type=radio]:checked+label{border-bottom:1px solid #05b}.book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.book-columns{margin-left:-1rem;margin-right:-1rem}.book-columns>div{margin:1rem 0;min-width:13.2rem;padding:0 1rem}a.book-btn{display:inline-block;color:#05b!important;text-decoration:none!important;border:1px solid #05b;border-radius:.15rem;padding:.25rem 1rem;margin-top:.5rem;margin-bottom:.5rem;cursor:pointer}.book-hint.info{border-left-color:#6bf;background-color:rgba(102,187,255,.1)}.book-hint.warning{border-left-color:#fd6;background-color:rgba(255,221,102,.1)}.book-hint.danger{border-left-color:#f66;background-color:rgba(255,102,102,.1)}
diff --git a/exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.json b/exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.json
new file mode 100644
index 0000000..ff08c21
--- /dev/null
+++ b/exampleSite/resources/_gen/assets/scss/theme/hugo-book/book.scss_50fc8c04e12a2f59027287995557ceff.json
@@ -0,0 +1 @@
+{"Target":"book.min.9655dddcbdb7746824f6a5a12c435a2fd6b9c5d6d7928958bf434d9563068728.css","MediaType":"text/css","Data":{"Integrity":"sha256-llXd3L23dGgk9qWhLENaL9a5xdbXkolYv0NNlWMGhyg="}} \ No newline at end of file
diff --git a/i18n/cn.yaml b/i18n/cn.yaml
new file mode 100644
index 0000000..fbef15a
--- /dev/null
+++ b/i18n/cn.yaml
@@ -0,0 +1,5 @@
+- id: Search
+ translation: 搜索
+
+- id: Edit this page
+ translation: Edit this page
diff --git a/i18n/en.yaml b/i18n/en.yaml
new file mode 100644
index 0000000..5398302
--- /dev/null
+++ b/i18n/en.yaml
@@ -0,0 +1,5 @@
+- id: Search
+ translation: Search
+
+- id: Edit this page
+ translation: Edit this page
diff --git a/i18n/ru.yaml b/i18n/ru.yaml
new file mode 100644
index 0000000..8093dbc
--- /dev/null
+++ b/i18n/ru.yaml
@@ -0,0 +1,5 @@
+- id: Search
+ translation: Поиск
+
+- id: Edit this page
+ translation: Редактировать эту сраницу
diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html
index 6ee6e40..38630a7 100644
--- a/layouts/docs/baseof.html
+++ b/layouts/docs/baseof.html
@@ -17,7 +17,7 @@
<div class="book-page">
{{ partial "docs/mobile-header" . }}
{{ template "main" . }}
- {{ partial "docs/git-footer" . }}
+ {{ partial "docs/footer" . }}
{{ partial "docs/inject/footer" . }}
</div>
diff --git a/layouts/partials/docs/git-footer.html b/layouts/partials/docs/footer.html
index bf3e4a7..15d1640 100644
--- a/layouts/partials/docs/git-footer.html
+++ b/layouts/partials/docs/footer.html
@@ -1,5 +1,6 @@
{{ if or .GitInfo .Site.Params.BookEditPath }}
<div class="book-footer {{ if not .GitInfo }}justify-end{{ else }}justify-between{{ end }}">
+ {{ partial "docs/languages" . }}
{{ with .GitInfo }}
<div>
{{ $date := .AuthorDate.Local.Format (default "January 2, 2006" $.Site.Params.BookDateFormat) }}
@@ -14,7 +15,7 @@
{{ if $.File }}
<a class="flex align-center" href="{{ $.Site.Params.BookRepo }}/{{ . }}/{{ $.File.Path }}" target="_blank" rel="noopener">
<img src="{{ "svg/edit.svg" | relURL }}" alt="Edit" />
- <span>Edit this page</span>
+ <span>{{ i18n "Edit this page" }}</span>
</a>
{{ end }}
</div>
diff --git a/layouts/partials/docs/language-switch.html b/layouts/partials/docs/language-switch.html
deleted file mode 100644
index 4a84ade..0000000
--- a/layouts/partials/docs/language-switch.html
+++ /dev/null
@@ -1,14 +0,0 @@
-{{ if .Site.IsMultiLingual }}
-<ul>
- <li class="book-section-flat">
- <span>{{ i18n "languages" }}</span>
- <ul>
- {{ range .Site.Home.AllTranslations -}}
- <li>
- <a href="{{ .Permalink }}" class="{{ if (eq $.Site.Language .Language ) }}active{{ end }}">{{ .Language.LanguageName }}</a>
- </li>
- {{- end }}
- </ul>
- </li>
-</ul>
-{{ end }}
diff --git a/layouts/partials/docs/languages.html b/layouts/partials/docs/languages.html
new file mode 100644
index 0000000..d905327
--- /dev/null
+++ b/layouts/partials/docs/languages.html
@@ -0,0 +1,32 @@
+{{ if .Site.IsMultiLingual }}
+<!-- Merge home and current page translations -->
+{{ $langs := dict }}
+{{ range .Site.Home.AllTranslations }}
+ {{ $langs = merge $langs (dict .Language.Lang .) }}
+{{ end }}
+{{ range .Translations }}
+ {{ $langs = merge $langs (dict .Language.Lang .) }}
+{{ end }}
+
+<div class="book-languages">
+
+ <ul>
+ <li class="flex">
+ <img src="{{ "svg/translate.svg" | relURL }}" />
+ {{ $.Site.Language.LanguageName }}
+ </li>
+ </ul>
+
+ <ul class="book-languages-list">
+ {{ range sort $langs }}
+ <li class="{{ if (eq $.Site.Language .Language ) }}active{{ end }}">
+ <a href="{{ .Permalink }}" class="flex">
+ <img src="{{ "svg/translate.svg" | relURL }}" />
+ {{ .Language.LanguageName }}
+ </a>
+ </li>
+ {{ end }}
+ </ul>
+
+</div>
+{{ end }}
diff --git a/layouts/partials/docs/menu-filetree.html b/layouts/partials/docs/menu-filetree.html
index c917828..30fc2ce 100644
--- a/layouts/partials/docs/menu-filetree.html
+++ b/layouts/partials/docs/menu-filetree.html
@@ -15,7 +15,7 @@
{{ end }}
{{ else }}
<ul>
- {{ range where $sections "Params.bookhidden" "!=" true }}
+ {{ range where $sections "Params.bookHidden" "!=" true }}
{{ template "book-section" (dict "Section" . "CurrentPage" $) }}
{{ end }}
</ul>
diff --git a/layouts/partials/docs/menu.html b/layouts/partials/docs/menu.html
index 3d04b04..6a72ac9 100644
--- a/layouts/partials/docs/menu.html
+++ b/layouts/partials/docs/menu.html
@@ -10,11 +10,6 @@
{{ end }}
{{ partial "docs/inject/menu-after" . }}
-
-{{ if .Site.IsMultiLingual }}
- {{ partial "docs/translation-switch" . }}
- {{ partial "docs/language-switch" . }}
-{{ end }}
</nav>
<!-- Restore menu position as soon as possible to avoid flickering -->
diff --git a/layouts/partials/docs/search.html b/layouts/partials/docs/search.html
index 17a14eb..5c8b912 100644
--- a/layouts/partials/docs/search.html
+++ b/layouts/partials/docs/search.html
@@ -1,6 +1,6 @@
{{ if default true .Site.Params.BookSearch }}
<div class="book-search">
- <input type="text" placeholder="Search" id="book-search-input" maxlength="64" />
+ <input type="text" placeholder="{{ i18n "Search" }}" id="book-search-input" maxlength="64" />
<div class="book-search-spinner spinner hidden"></div>
<ul id="book-search-results"></ul>
</div>
diff --git a/layouts/partials/docs/translation-switch.html b/layouts/partials/docs/translation-switch.html
deleted file mode 100644
index 4ad0f1a..0000000
--- a/layouts/partials/docs/translation-switch.html
+++ /dev/null
@@ -1,14 +0,0 @@
-{{ if .IsTranslated }}
-<ul>
- <li class="book-section-flat">
- <span>{{ i18n "translations" }}</span>
- <ul>
- {{ range .Translations }}
- <li>
- <a href="{{ .Permalink }}">{{ .Lang }}: {{ .Title }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
- </li>
- {{ end }}
- </ul>
- </li>
-</ul>
-{{ end }} \ No newline at end of file
diff --git a/layouts/posts/baseof.html b/layouts/posts/baseof.html
index c58d552..9777d48 100644
--- a/layouts/posts/baseof.html
+++ b/layouts/posts/baseof.html
@@ -17,7 +17,7 @@
<div class="book-posts">
{{ partial "docs/mobile-header" . }}
{{ template "main" . }}
- {{ partial "docs/git-footer" . }}
+ {{ partial "docs/footer" . }}
{{ partial "docs/inject/footer" . }}
</div>
diff --git a/static/svg/translate.svg b/static/svg/translate.svg
new file mode 100644
index 0000000..a1bbe16
--- /dev/null
+++ b/static/svg/translate.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"/></svg> \ No newline at end of file