Refactor translation codes
This commit is contained in:
parent
5da3cf5ebf
commit
db5a18f80d
12 changed files with 96 additions and 68 deletions
|
@ -33,8 +33,8 @@ disqusShortname: does-not-exist
|
|||
|
||||
# Enable global emoji support
|
||||
enableEmoji: true
|
||||
|
||||
# Custom parameters
|
||||
|
||||
params:
|
||||
# Copyright Notice
|
||||
copyright: © 2020 Copyright.
|
||||
|
|
16
exampleSite/data/en/author.yaml
Normal file
16
exampleSite/data/en/author.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
# some information about you
|
||||
name: "Jane Doe"
|
||||
nickname: "Jane"
|
||||
image: "images/avatar.png"
|
||||
# give your some contact information. they will be used in the footer
|
||||
contactInfo:
|
||||
email: "janedoe@example.com"
|
||||
phone: "+0123456789"
|
||||
|
||||
# some summary about what you do
|
||||
summary:
|
||||
- I am a Developer
|
||||
- I am a Devops
|
||||
- I love servers
|
||||
- I work on open-source projects
|
||||
- I love to work with some fun projects"
|
|
@ -1,6 +0,0 @@
|
|||
summary:
|
||||
- I am a Developer
|
||||
- I am a Devops
|
||||
- I love servers
|
||||
- I work on open-source projects
|
||||
- I love to work with some fun projects"
|
14
exampleSite/data/fr/author.yaml
Normal file
14
exampleSite/data/fr/author.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
nickname: "Jane"
|
||||
image: "images/avatar.png"
|
||||
# give your some contact information. they will be used in the footer
|
||||
contactInfo:
|
||||
email: "janedoe@example.com"
|
||||
phone: "+0123456789"
|
||||
|
||||
# some summary about what you do
|
||||
summary:
|
||||
- Je suis un développeur
|
||||
- Je suis un Devops
|
||||
- J'aime les serveurs
|
||||
- Je travaille sur des projets open-source
|
||||
- J'aime travailler avec des projets amusants
|
|
@ -1,6 +0,0 @@
|
|||
summary:
|
||||
- Je suis un développeur
|
||||
- Je suis un Devops
|
||||
- J'aime les serveurs
|
||||
- Je travaille sur des projets open-source
|
||||
- J'aime travailler avec des projets amusants
|
|
@ -1,5 +1,5 @@
|
|||
# More documentation here: https://github.com/nicksnyder/go-i18n
|
||||
[profile]
|
||||
[greeting]
|
||||
other = "Hello, I am"
|
||||
|
||||
[home]
|
||||
|
@ -17,7 +17,7 @@ other = "Contact me:"
|
|||
[newsletter_text]
|
||||
other = "Stay up to date with email notification"
|
||||
|
||||
[newsletter_input]
|
||||
[newsletter_input_placeholder]
|
||||
other = "Enter email"
|
||||
|
||||
[newsletter_warning]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# More documentation here: https://github.com/nicksnyder/go-i18n
|
||||
[profile]
|
||||
[greeting]
|
||||
other = "Bonjour, je suis"
|
||||
|
||||
[home]
|
||||
|
@ -17,7 +17,7 @@ other = "Contactez moi :"
|
|||
[newsletter_text]
|
||||
other = "Restez à jour par e-mail"
|
||||
|
||||
[newsletter_input]
|
||||
[newsletter_input_placeholder]
|
||||
other = "Entrez une adresse e-mail"
|
||||
|
||||
[newsletter_warning]
|
||||
|
|
|
@ -29,28 +29,14 @@
|
|||
{{- partial "sections/home.html" . -}}
|
||||
|
||||
<!--- ADD OPTIONAL SECTIONS ----------->
|
||||
{{ $sections:= .Site.Data.sections }}
|
||||
{{ if (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ $sections = (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ end }}
|
||||
|
||||
{{ if $sections }}
|
||||
{{ $background:= "bg-white"}}
|
||||
{{ range sort (index .Site.Data .Site.Language.Lang).sections "section.weight" }}
|
||||
{{ if .section.enable }}
|
||||
<div class="container-fluid section-holder d-flex {{ $background }}">
|
||||
{{ if .section.template }}
|
||||
{{- partial .section.template . -}}
|
||||
{{ else }}
|
||||
{{- partial (printf "sections/%s.html" (replace (lower .section.name) " " "-")) . -}}
|
||||
{{ end }}
|
||||
</div>
|
||||
<!--- alter background color for next section --->
|
||||
{{ if eq $background "bg-white" }}
|
||||
{{ $background = "bg-dimmed" }}
|
||||
{{ else }}
|
||||
{{ $background = "bg-white" }}
|
||||
{{end}}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else if .Site.Data.sections }}
|
||||
{{ $background:= "bg-white"}}
|
||||
{{ range sort .Site.Data.sections "section.weight" }}
|
||||
{{ range sort $sections "section.weight" }}
|
||||
{{ if .section.enable }}
|
||||
<div class="container-fluid section-holder d-flex {{ $background }}">
|
||||
{{ if .section.template }}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<div>
|
||||
<div class="d-flex">
|
||||
{{ if .logo }}
|
||||
<img class="card-img-xs" src="/{{ .logo }}" alt="{{ .name }}" />
|
||||
<img class="card-img-xs" src="{{ .logo }}" alt="{{ .name }}" />
|
||||
{{ end }}
|
||||
<h5 class="card-title mb-0">{{ .name }}</h5>
|
||||
</div>
|
||||
|
|
|
@ -1,11 +1,21 @@
|
|||
{{ $author:= .Site.Data.author }}
|
||||
{{ if (index .Site.Data .Site.Language.Lang).author }}
|
||||
{{ $author = (index .Site.Data .Site.Language.Lang).author }}
|
||||
{{ end }}
|
||||
|
||||
{{ $sections:= .Site.Data.sections }}
|
||||
{{ if (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ $sections = (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ end }}
|
||||
|
||||
<footer class="container-fluid text-center align-content-center footer pb-2">
|
||||
<div class="container pt-5">
|
||||
<div class="row text-left">
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<h5>{{ i18n "navigation" }}</h5>
|
||||
{{ if (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ if $sections }}
|
||||
<ul>
|
||||
{{- range sort (index .Site.Data .Site.Language.Lang).sections "section.weight" }}
|
||||
{{- range sort $sections "section.weight" }}
|
||||
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
||||
<li class="nav-item">
|
||||
<a class="smooth-scroll" href="/#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
|
||||
|
@ -13,27 +23,19 @@
|
|||
{{ end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{ else if .Site.Data.sections }}
|
||||
<ul>
|
||||
{{- range sort .Site.Data.sections "section.weight" }}
|
||||
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
||||
<li class="nav-item">
|
||||
<a class="smooth-scroll" href="/#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
{{ if $author }}
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<h5>{{ i18n "contact_me" }}</h5>
|
||||
<ul>
|
||||
{{ range $key,$value:=.Site.Params.author.contactInfo }}
|
||||
{{ range $key,$value:= $author.contactInfo }}
|
||||
<li><span>{{ title $key }}: </span> <span>{{ $value }}</span></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if .Site.Params.newsletter.enable }}
|
||||
<div class="col-md-4 col-sm-12">
|
||||
<!-- <h5>Newsletter</h5> -->
|
||||
|
@ -45,7 +47,7 @@
|
|||
class="form-control"
|
||||
id="exampleInputEmail1"
|
||||
aria-describedby="emailHelp"
|
||||
placeholder="{{ i18n "newsletter_input" }}"
|
||||
placeholder="{{ i18n "newsletter_input_placeholder" }}"
|
||||
/>
|
||||
<small id="emailHelp" class="form-text text-muted"
|
||||
>{{ i18n "newsletter_warning" }}</small
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
{{ $sections:= .Site.Data.sections }}
|
||||
{{ if (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ $sections = (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ end }}
|
||||
|
||||
<nav class="navbar navbar-expand-xl top-navbar initial-navbar" id="top-navbar">
|
||||
<div class="container">
|
||||
{{ $mainLogo:="/assets/images/main-logo.png" }}
|
||||
|
@ -27,16 +32,8 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" href="#home">{{ i18n "home" }}</a>
|
||||
</li>
|
||||
{{ if (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ range sort (index .Site.Data .Site.Language.Lang).sections "section.weight" }}
|
||||
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
{{ else if .Site.Data.sections }}
|
||||
{{ range sort .Site.Data.sections "section.weight" }}
|
||||
{{ if $sections }}
|
||||
{{ range sort $sections "section.weight" }}
|
||||
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
{{ $greeting:="Hi! I am" }}
|
||||
{{ if .Site.Params.author.greeting }}
|
||||
{{ $greeting = .Site.Params.author.greeting }}
|
||||
|
@ -8,33 +9,57 @@
|
|||
{{ else if .Site.Params.author.name }}
|
||||
{{ $name = .Site.Params.author.name }}
|
||||
{{ end }}
|
||||
=======
|
||||
{{ $author:= .Site.Data.author }}
|
||||
{{ if (index .Site.Data .Site.Language.Lang).author }}
|
||||
{{ $author = (index .Site.Data .Site.Language.Lang).author }}
|
||||
{{ end }}
|
||||
|
||||
{{ $sections:= .Site.Data.sections }}
|
||||
{{ if (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ $sections = (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ end }}
|
||||
|
||||
>>>>>>> Refactor translation codes
|
||||
<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 }}');"
|
||||
></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="{{ if $author.image }}{{ $author.image }}{{ else }}/assets/images/default-avatar.png{{ end }}"
|
||||
class="rounded-circle mx-auto d-block img-fluid"
|
||||
/>
|
||||
<<<<<<< HEAD
|
||||
<h1 class="greeting"> {{ $greeting }} {{ $name }}</h1>
|
||||
=======
|
||||
<h1 class="greeting">{{ i18n "greeting" }}
|
||||
{{ if $author.nickname }}
|
||||
{{ $author.nickname }}
|
||||
{{ else if $author.name }}
|
||||
{{ $author.name }}
|
||||
{{ else }}
|
||||
Jane Doe
|
||||
{{ end }}
|
||||
</h1>
|
||||
>>>>>>> Refactor translation codes
|
||||
<div class="typing-carousel">
|
||||
<span id="ityped" class="ityped"></span>
|
||||
<span class="ityped-cursor"></span>
|
||||
</div>
|
||||
<ul id="typing-carousel-data">
|
||||
{{ if .Site.Params.author.summary }}
|
||||
{{ range .Site.Params.author.summary }}
|
||||
{{ if $author.summary }}
|
||||
{{ range $author.summary }}
|
||||
<li>{{ . }}</li>
|
||||
{{ end}}
|
||||
{{ else }}
|
||||
{{ range (index .Site.Data .Site.Language.Lang).home.summary }}
|
||||
{{ range $author.summary }}
|
||||
<li>{{ . }}</li>
|
||||
{{ end}}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ if (index .Site.Data .Site.Language.Lang).sections }}
|
||||
{{ range first 1 (where (sort (index .Site.Data .Site.Language.Lang).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 }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue