Translations and i18n (#60)

* Managing i18n

* Fix absolute path

* Config files

* Home link manage langage

* Fixing footer i18n

* Implemented i18n on newsletter

* Implemented two languages in example

* Removed old section directory

* Using yaml in data to organize home summary

* Fully working for old versions without i18n

* Integrating language menu CSS

* Fix language dropdown CSS

* Refactor translation codes

* Remove duplicate code

* Fix URL issues

* Move customMenus and other site related config into data section

* Fix error during language toggle

* Only show the available translation for the posts

* Handle navbar brand URL properly

* Fix responsiveness

Co-authored-by: Hugo MARTIN <hugo.martin.69@gmail.com>
Co-authored-by: hossainemruz <emruz@appscode.com>
This commit is contained in:
Hugo MARTIN 2020-10-03 05:59:28 +02:00 committed by GitHub
parent 6c2cca0127
commit 46b21e028c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 1116 additions and 190 deletions

View file

@ -1,34 +1,53 @@
{{ $greeting:="Hi! I am" }}
{{ if .Site.Params.author.greeting }}
{{ $greeting = .Site.Params.author.greeting }}
{{ $author:= .Site.Data.author }}
{{ if (index .Site.Data .Site.Language.Lang).author }}
{{ $author = (index .Site.Data .Site.Language.Lang).author }}
{{ end }}
{{ $name:="Jane Doe" }}
{{ if .Site.Params.author.nickname }}
{{ $name = .Site.Params.author.nickname }}
{{ else if .Site.Params.author.name }}
{{ $name = .Site.Params.author.name }}
{{ if $author.nickname }}
{{ $name = $author.nickname }}
{{ else if $author.name }}
{{ $name = $author.name }}
{{ end }}
{{ $sections:= .Site.Data.sections }}
{{ if (index .Site.Data .Site.Language.Lang).sections }}
{{ $sections = (index .Site.Data .Site.Language.Lang).sections }}
{{ end }}
{{ $backgroundImage:= "assets/images/default-background.jpg" }}
{{ if .Site.Params.background }}
{{ $backgroundImage = .Site.Params.background }}
{{ end }}
{{ $authorImage:= "assets/images/default-avatar.png" }}
{{ if $author.image }}
{{ $authorImage = $author.image }}
{{ end }}
<div class="container-fluid home" id="home">
<div
class="background container-fluid"
style="background-image: url('{{ if .Site.Params.background }}{{ .Site.Params.background }}{{ else }}/assets/images/default-background.jpg{{ end }}');"
style="background-image: url('{{ $backgroundImage | absURL }}');"
></div>
<div class="container content text-center">
<img src="{{ if .Site.Params.author.image }}{{ .Site.Params.author.image }}{{ else }}/assets/images/default-avatar.png{{ end }}"
<img src="{{ $authorImage | absURL }}"
class="rounded-circle mx-auto d-block img-fluid"
/>
<h1 class="greeting"> {{ $greeting }} {{ $name }}</h1>
<h1 class="greeting"> {{ $author.greeting }} {{ $name }}</h1>
<div class="typing-carousel">
<span id="ityped" class="ityped"></span>
<span class="ityped-cursor"></span>
</div>
<ul id="typing-carousel-data">
{{ range .Site.Params.author.summary }}
<li>{{ . }}</li>
{{ if $author.summary }}
{{ range $author.summary }}
<li>{{ . }}</li>
{{ end}}
{{ end }}
</ul>
{{ if .Site.Data.sections }}
{{ range first 1 (where (sort .Site.Data.sections "section.weight") ".section.enable" true) }}
{{ if $sections }}
{{ range first 1 (where (sort $sections "section.weight") ".section.enable" true) }}
<a href="#{{ replace (lower .section.name) " " "-" }}"><i class="arrow bounce fa fa-chevron-down"></i></a>
{{ end }}
{{ end }}