From 13c99afe10b5bd307732c9fafc13821d2147f928 Mon Sep 17 00:00:00 2001
From: Luiz F. A. de Prá <luizdepra@users.noreply.github.com>
Date: Sat, 09 Feb 2019 14:36:32 +0000
Subject: [PATCH] Add pt-br i18n (#144)

---
 exampleSite/config.toml                  |   54 +++++++----------
 layouts/partials/list.html               |    2 
 exampleSite/content/posts/dummy.pt-br.md |    9 +++
 layouts/partials/404.html                |    4 
 exampleSite/content/about.pt-br.md       |    6 ++
 i18n/pt-br.toml                          |   21 +++++++
 /dev/null                                |    6 --
 layouts/_default/list.html               |    2 
 layouts/posts/single.html                |    2 
 exampleSite/content/contact.pt-br.md     |    6 ++
 exampleSite/content/projects.pt-br.md    |    6 ++
 i18n/en.toml                             |   20 ++++++
 layouts/partials/footer.html             |    2 
 13 files changed, 96 insertions(+), 44 deletions(-)

diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 135042c..742aea3 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -4,6 +4,7 @@
 theme = "hugo-coder"
 
 languagecode = "en"
+defaultcontentlanguage = "en"
 
 paginate = 20
 canonifyurls = true
@@ -67,17 +68,7 @@
 
 [languages]
     [languages.en]
-        languagename = "English" # The language name to be displayed in the selector.
-        title = "John Doe"
-
-        # You can configure the theme parameter for each language.
-        [languages.en.params]
-        author = "John Doe"
-        info = "Full Stack DevOps and Magician"
-        description = "John Doe's personal website"
-        keywords = "blog,developer,personal"
-
-        [languages.en.menu] # It is possible to change the menu too.
+        languagename = "English"
 
         [[languages.en.menu.main]]
         name = "About"
@@ -100,34 +91,35 @@
         url = "/contact/"
 
 
-    [languages.pl]
-        languagename = "Polski"
-        title = "John Doe po polsku"
+    [languages.pt-br]
+        languagename = "Português"
+        title = "João Ninguém"
 
-        [languages.pl.params]
-            author = "John Doe"
-            description = "Strona domowa John'a Doe"
-            keywords = "blog,developer,strona domowa"
-            info = "Full Stack DevOps i Magik"
+        [languages.pt-br.params]
+            author = "João Ninguém"
+            info = "Full Stack DevOps e Mágico"
+            description = "Sítio pessoal de João Ninguém"
+            keywords = "blog,desenvolvedor,pessoal"
+            footercontent = "Coloque algum texto aqui."
 
-        [languages.pl.menu]
+        [languages.pt-br.menu]
 
-            [[languages.pl.menu.main]]
-            name = "O mnie"
+            [[languages.pt-br.menu.main]]
+            name = "Sobre"
             weight = 1
-            url = "/pl/about/"
+            url = "/pt-br/about/"
 
-            [[languages.pl.menu.main]]
+            [[languages.pt-br.menu.main]]
             name = "Blog"
             weight = 2
-            url = "/pl/posts/"
+            url = "/pt-br/posts/"
 
-            [[languages.pl.menu.main]]
-            name = "Projektowanie"
+            [[languages.pt-br.menu.main]]
+            name = "Projetos"
             weight = 3
-            url = "/pl/projects/"
+            url = "/pt-br/projects/"
 
-            [[languages.pl.menu.main]]
-            name = "Kontakt"
+            [[languages.pt-br.menu.main]]
+            name = "Contato"
             weight = 5
-            url = "/pl/contact/"
+            url = "/pt-br/contact/"
diff --git a/exampleSite/content/about.pl.md b/exampleSite/content/about.pl.md
deleted file mode 100644
index a7bd248..0000000
--- a/exampleSite/content/about.pl.md
+++ /dev/null
@@ -1,6 +0,0 @@
-+++
-title = "About Hugo"
-slug = "about"
-+++
-
-w budowie...
\ No newline at end of file
diff --git a/exampleSite/content/about.pt-br.md b/exampleSite/content/about.pt-br.md
new file mode 100644
index 0000000..f582dff
--- /dev/null
+++ b/exampleSite/content/about.pt-br.md
@@ -0,0 +1,6 @@
++++
+title = "Sobre Hugo"
+slug = "about"
++++
+
+Em construção... Aguarde!
\ No newline at end of file
diff --git a/exampleSite/content/contact.pl.md b/exampleSite/content/contact.pl.md
deleted file mode 100644
index c86f5f4..0000000
--- a/exampleSite/content/contact.pl.md
+++ /dev/null
@@ -1,6 +0,0 @@
-+++
-title = "Kontakt"
-slug = "contact"
-+++
-
-Chodź za mną, @johndoe.
\ No newline at end of file
diff --git a/exampleSite/content/contact.pt-br.md b/exampleSite/content/contact.pt-br.md
new file mode 100644
index 0000000..241861c
--- /dev/null
+++ b/exampleSite/content/contact.pt-br.md
@@ -0,0 +1,6 @@
++++
+title = "Contato"
+slug = "contact"
++++
+
+Me siga em @joaoninguem.
\ No newline at end of file
diff --git a/exampleSite/content/posts/dummy.pl.md b/exampleSite/content/posts/dummy.pl.md
deleted file mode 100644
index 6c92163..0000000
--- a/exampleSite/content/posts/dummy.pl.md
+++ /dev/null
@@ -1,6 +0,0 @@
-+++ 
-date = "2018-12-31"
-title = "Dummy"
-+++
-
-w budowie...
\ No newline at end of file
diff --git a/exampleSite/content/posts/dummy.pt-br.md b/exampleSite/content/posts/dummy.pt-br.md
new file mode 100644
index 0000000..961957b
--- /dev/null
+++ b/exampleSite/content/posts/dummy.pt-br.md
@@ -0,0 +1,9 @@
++++ 
+date = "2018-12-31"
+title = "Dummy"
+slug = "dummy" 
+tags = ["hugo", "i18n"]
+categories = ["blog"]
++++
+
+Nada para ver aqui!
\ No newline at end of file
diff --git a/exampleSite/content/projects.pl.md b/exampleSite/content/projects.pl.md
deleted file mode 100644
index 0ba1803..0000000
--- a/exampleSite/content/projects.pl.md
+++ /dev/null
@@ -1,6 +0,0 @@
-+++
-title = "Projektowanie"
-slug = "projects"
-+++
-
-w budowie...
\ No newline at end of file
diff --git a/exampleSite/content/projects.pt-br.md b/exampleSite/content/projects.pt-br.md
new file mode 100644
index 0000000..c728812
--- /dev/null
+++ b/exampleSite/content/projects.pt-br.md
@@ -0,0 +1,6 @@
++++
+title = "Projetos"
+slug = "projects"
++++
+
+Em construção... Aguarde!
\ No newline at end of file
diff --git a/i18n/en.toml b/i18n/en.toml
index a9672b6..0aa2010 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -1,3 +1,21 @@
-[readingTime]
+[category]
+other = "category"
+
+[tag]
+other = "tag"
+
+[reading_time]
 one = "One minute read"
 other = "{{ .Count }} minutes read"
+
+[page_not_found]
+other = "Page Not Found"
+
+[page_does_not_exist]
+other = "Sorry, this page does not exist."
+
+[head_back]
+other = "You can head back to <a href=\"{{ . }}\">homepage</a>."
+
+[powered_by]
+other = "Powered by"
diff --git a/i18n/pt-br.toml b/i18n/pt-br.toml
new file mode 100644
index 0000000..1ab305f
--- /dev/null
+++ b/i18n/pt-br.toml
@@ -0,0 +1,21 @@
+[category]
+other = "categoria"
+
+[tag]
+other = "tag"
+
+[reading_time]
+one = "Um minuto de leitura"
+other = "{{ .Count }} minutos de leitura"
+
+[page_not_found]
+other = "Página Não Encontrada"
+
+[page_does_not_exist]
+other = "Desculpe, essa página não existe."
+
+[head_back]
+other = "Você pode voltar para a <a href=\"{{ . }}\">página inicial</a>."
+
+[powered_by]
+other = "Promovido por"
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index d62bc46..54fca03 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,6 +1,6 @@
 {{ define "title" }}
   {{- if eq .Kind "taxonomy" -}}
-    {{- .Data.Singular | title -}}
+    {{- i18n .Data.Singular | title -}}
     {{- print ": " -}}
   {{- end -}}
 
diff --git a/layouts/partials/404.html b/layouts/partials/404.html
index 7df669c..a884c68 100644
--- a/layouts/partials/404.html
+++ b/layouts/partials/404.html
@@ -1,7 +1,7 @@
 <section class="container centered">
   <div class="error">
     <h1>404</h1>
-    <h2>Page Not Found</h2>
-    <p>Sorry, this page does not exist.<br />You can head back to <a href="{{ .Site.BaseURL }}">homepage</a>.</p>
+    <h2>{{ i18n "page_not_found" }}</h2>
+    <p>{{ i18n "page_does_not_exist" }}<br />{{ i18n "head_back" .Site.BaseURL | safeHTML }}</p>
   </div>
 </section>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 57f3507..cd5f833 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -6,7 +6,7 @@
     {{ if not .Site.Params.hideCopyright }} © {{ now.Format "2006" }}{{ end }}
     {{ if not .Site.Params.hideCredits }}
       {{ if not .Site.Params.hideCopyright }} · {{ end }}
-      Powered by <a href="https://gohugo.io/">Hugo</a> & <a href="https://github.com/luizdepra/hugo-coder/">Coder</a>.
+      {{ i18n "powered_by" }} <a href="https://gohugo.io/">Hugo</a> & <a href="https://github.com/luizdepra/hugo-coder/">Coder</a>.
     {{ end }}
     {{ if .Site.Params.commit }}
       {{ if or (not .Site.Params.hideCredits) (not .Site.Params.hideCopyright) }} · {{ end }}
diff --git a/layouts/partials/list.html b/layouts/partials/list.html
index 5c4aa56..13aa1ca 100644
--- a/layouts/partials/list.html
+++ b/layouts/partials/list.html
@@ -1,7 +1,7 @@
 <section class="container list">
   <h1 class="title">
     {{- if eq .Kind "taxonomy" -}}
-      {{- .Data.Singular | title -}}
+      {{- i18n .Data.Singular | title -}}
       {{- print ": " -}}
     {{- end -}}
 
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index 5a72d8c..2e8bdf5 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -18,7 +18,7 @@
             </span>
             <span class="reading-time">
               <i class="fas fa-clock"></i>
-              {{ i18n "readingTime" .ReadingTime }}
+              {{ i18n "reading_time" .ReadingTime }}
             </span>
           </div>
           {{ with .Page.Params.Categories }}{{ partial "taxonomy/categories" . }}{{ end }}

--
Gitblit v1.10.0