From ce44cabbbc5d42a69c60d79e63ab339a89996ad4 Mon Sep 17 00:00:00 2001 From: Kapunahele Wong Date: Fri, 30 Jul 2021 12:11:25 -0400 Subject: [PATCH] add i18n Signed-off-by: Kapunahele Wong --- config.yaml | 37 ++++++++++++++++++- content/ar/blah.md | 10 +++++ content/{ => en}/docs/_index.md | 0 content/{ => en}/docs/demo.md | 0 content/{ => en}/docs/quickstart/_index.md | 0 .../{ => en}/docs/quickstart/quickstart1.md | 0 .../{ => en}/docs/quickstart/quickstart2.md | 0 content/{ => en}/docs/reference/_index.md | 0 content/{ => en}/docs/reference/reference1.md | 0 content/{ => en}/docs/reference/reference2.md | 0 content/{ => en}/docs/tutorials/_index.md | 0 content/{ => en}/docs/tutorials/tutorial1.md | 0 content/{ => en}/docs/tutorials/tutorial2.md | 0 content/fr/blah.md | 10 +++++ content/pt/blah.md | 10 +++++ content/spa/blah.md | 10 +++++ i18n/en-US.yaml | 2 + layouts/_default/baseof.html | 2 + layouts/partials/allLanguages.html | 5 +++ layouts/partials/i18nlist.html | 10 +++++ 20 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 content/ar/blah.md rename content/{ => en}/docs/_index.md (100%) rename content/{ => en}/docs/demo.md (100%) rename content/{ => en}/docs/quickstart/_index.md (100%) rename content/{ => en}/docs/quickstart/quickstart1.md (100%) rename content/{ => en}/docs/quickstart/quickstart2.md (100%) rename content/{ => en}/docs/reference/_index.md (100%) rename content/{ => en}/docs/reference/reference1.md (100%) rename content/{ => en}/docs/reference/reference2.md (100%) rename content/{ => en}/docs/tutorials/_index.md (100%) rename content/{ => en}/docs/tutorials/tutorial1.md (100%) rename content/{ => en}/docs/tutorials/tutorial2.md (100%) create mode 100644 content/fr/blah.md create mode 100644 content/pt/blah.md create mode 100644 content/spa/blah.md create mode 100644 i18n/en-US.yaml create mode 100644 layouts/partials/allLanguages.html create mode 100644 layouts/partials/i18nlist.html diff --git a/config.yaml b/config.yaml index de36ecf..647e7d3 100644 --- a/config.yaml +++ b/config.yaml @@ -65,5 +65,40 @@ menu: url: / weight: 1 - name: Documentation - url: /docs/ + url: /en/docs/ weight: 2 + + +# Internationalization + +defaultContentLanguage: en + +# show language abbreviation in url. If you enable this option, remember to update image paths +# defaultContentLanguageInSubdir: true +languages: + ar: + contentDir: content/ar + languageName: عربى + languagedirection: rtl + title: مدونتي + weight: 2 + en: + contentDir: content/en + languageName: English + title: My project + weight: 1 + esp: + contentDir: content/spa + languageName: Español + title: Mi proyecto + weight: 2 + fr: + contentDir: content/fr + languageName: Français + title: Mon projet + weight: 2 + pt-pt: + contentDir: content/pt + languageName: Português + title: O meu blog + weight: 3 diff --git a/content/ar/blah.md b/content/ar/blah.md new file mode 100644 index 0000000..e7274ff --- /dev/null +++ b/content/ar/blah.md @@ -0,0 +1,10 @@ +--- +title: "Introduction" +description: "Arabic blah.md" +toc: true +weight: 1 +--- + +## Arabic languge docs + +Add your Arabic language docs in this directory. \ No newline at end of file diff --git a/content/docs/_index.md b/content/en/docs/_index.md similarity index 100% rename from content/docs/_index.md rename to content/en/docs/_index.md diff --git a/content/docs/demo.md b/content/en/docs/demo.md similarity index 100% rename from content/docs/demo.md rename to content/en/docs/demo.md diff --git a/content/docs/quickstart/_index.md b/content/en/docs/quickstart/_index.md similarity index 100% rename from content/docs/quickstart/_index.md rename to content/en/docs/quickstart/_index.md diff --git a/content/docs/quickstart/quickstart1.md b/content/en/docs/quickstart/quickstart1.md similarity index 100% rename from content/docs/quickstart/quickstart1.md rename to content/en/docs/quickstart/quickstart1.md diff --git a/content/docs/quickstart/quickstart2.md b/content/en/docs/quickstart/quickstart2.md similarity index 100% rename from content/docs/quickstart/quickstart2.md rename to content/en/docs/quickstart/quickstart2.md diff --git a/content/docs/reference/_index.md b/content/en/docs/reference/_index.md similarity index 100% rename from content/docs/reference/_index.md rename to content/en/docs/reference/_index.md diff --git a/content/docs/reference/reference1.md b/content/en/docs/reference/reference1.md similarity index 100% rename from content/docs/reference/reference1.md rename to content/en/docs/reference/reference1.md diff --git a/content/docs/reference/reference2.md b/content/en/docs/reference/reference2.md similarity index 100% rename from content/docs/reference/reference2.md rename to content/en/docs/reference/reference2.md diff --git a/content/docs/tutorials/_index.md b/content/en/docs/tutorials/_index.md similarity index 100% rename from content/docs/tutorials/_index.md rename to content/en/docs/tutorials/_index.md diff --git a/content/docs/tutorials/tutorial1.md b/content/en/docs/tutorials/tutorial1.md similarity index 100% rename from content/docs/tutorials/tutorial1.md rename to content/en/docs/tutorials/tutorial1.md diff --git a/content/docs/tutorials/tutorial2.md b/content/en/docs/tutorials/tutorial2.md similarity index 100% rename from content/docs/tutorials/tutorial2.md rename to content/en/docs/tutorials/tutorial2.md diff --git a/content/fr/blah.md b/content/fr/blah.md new file mode 100644 index 0000000..b4202bb --- /dev/null +++ b/content/fr/blah.md @@ -0,0 +1,10 @@ +--- +title: "Introduction" +description: "French blah.md" +toc: true +weight: 1 +--- + +## French languge docs + +Add your French language docs in this directory. \ No newline at end of file diff --git a/content/pt/blah.md b/content/pt/blah.md new file mode 100644 index 0000000..3f661ba --- /dev/null +++ b/content/pt/blah.md @@ -0,0 +1,10 @@ +--- +title: "Introduction" +description: "Portuguese blah.md" +toc: true +weight: 1 +--- + +## Portuguese languge docs + +Add your Portuguese language docs in this directory. \ No newline at end of file diff --git a/content/spa/blah.md b/content/spa/blah.md new file mode 100644 index 0000000..bc8cce0 --- /dev/null +++ b/content/spa/blah.md @@ -0,0 +1,10 @@ +--- +title: "Introduction" +description: "Spanish blah.md" +toc: true +weight: 1 +--- + +## Spanish languge docs + +Add your Spanish language docs in this directory. \ No newline at end of file diff --git a/i18n/en-US.yaml b/i18n/en-US.yaml new file mode 100644 index 0000000..d0b8278 --- /dev/null +++ b/i18n/en-US.yaml @@ -0,0 +1,2 @@ +home: + other: Home \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index c00674a..023d6c0 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -21,6 +21,8 @@ {{ partial "navbar.html" . }}
+ {{ partial "i18nlist.html" }} + {{ partial "allLanguages.html" }} {{ block "main" . }} {{ end }}
diff --git a/layouts/partials/allLanguages.html b/layouts/partials/allLanguages.html new file mode 100644 index 0000000..4bde191 --- /dev/null +++ b/layouts/partials/allLanguages.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/layouts/partials/i18nlist.html b/layouts/partials/i18nlist.html new file mode 100644 index 0000000..1bd6d44 --- /dev/null +++ b/layouts/partials/i18nlist.html @@ -0,0 +1,10 @@ +{{ if .IsTranslated }} +

{{ i18n "translations" }}

+ +{{ end }} \ No newline at end of file