Unverified Commit 219fb00c authored by Martin Lowe's avatar Martin Lowe 🇨🇦 Committed by GitHub
Browse files

Multilingual support for the testimonials component #165 (#211)



Added multilingual + multi testimonial set support
Signed-off-by: Martin Lowe's avatarMartin Lowe <martin.lowe@eclipse-foundation.org>
parent d2075571
---
title: "Testimonials"
date: 2019-04-17T15:52:22-04:00
description: ""
categories: []
keywords: []
slug: ""
aliases: []
toc: false
draft: false
---
You can add testimonials to a markdown file using the shortcode **{{&lt; testimonials &gt;}}**
To add testimonials, create a **testimonials.yml** file in the data folder and add the code below:
~~~~
items:
-
text: Text of the testimonial 1
title: Name of the person
-
text: Text of the testimonial 2
title: Name of the person
~~~~
## Base data source
{{< testimonials >}}
## With localized copies EN + FR, w/ fallback in `./data`
{{< testimonials source="localized_testimonials">}}
## With localized copies EN + FR, w/o fallback in `./data`
{{< testimonials source="localized_testimonials_no_fallback" >}}
---
title: "Testimonials"
date: 2019-04-17T15:52:22-04:00
description: ""
categories: []
keywords: []
slug: ""
aliases: []
toc: false
draft: false
---
You can add testimonials to a markdown file using the shortcode **{{&lt; testimonials &gt;}}**
To add testimonials, create a **testimonials.yml** file in the data folder and add the code below:
~~~~
items:
-
text: Text of the testimonial 1
title: Name of the person
-
text: Text of the testimonial 2
title: Name of the person
~~~~
## Base data source
{{< testimonials >}}
## With localized copies EN + FR, w/ fallback in `./data`
{{< testimonials source="localized_testimonials">}}
## With localized copies EN + FR, w/o fallback in `./data`
{{< testimonials source="localized_testimonials_no_fallback" >}}
......@@ -23,3 +23,15 @@ items:
text: Text of the testimonial 2
title: Name of the person
~~~~
## Base data source
{{< testimonials >}}
## With localized copies EN + FR, w/ fallback in `./data`
{{< testimonials source="localized_testimonials">}}
## With localized copies EN + FR, w/o fallback in `./data`
{{< testimonials source="localized_testimonials_no_fallback" >}}
items:
-
text: Text of the testimonial 1(localized, en)
title: Name of the person
-
text: Text of the testimonial 2
title: Name of the person
-
text: Text of the testimonial 3
title: Name of the person
\ No newline at end of file
items:
-
text: Text of the testimonial 1(localized no fallback, en)
title: Name of the person
-
text: Text of the testimonial 2
title: Name of the person
-
text: Text of the testimonial 3
title: Name of the person
\ No newline at end of file
items:
-
text: Text of the testimonial 1(localized, fr)
title: Name of the person
-
text: Text of the testimonial 2
title: Name of the person
-
text: Text of the testimonial 3
title: Name of the person
\ No newline at end of file
items:
-
text: Text of the testimonial 1(localized no fallback, fr)
title: Name of the person
-
text: Text of the testimonial 2
title: Name of the person
-
text: Text of the testimonial 3
title: Name of the person
\ No newline at end of file
items:
-
text: Text of the testimonial 1 (localized backup, no lang)
title: Name of the person
-
text: Text of the testimonial 2
title: Name of the person
-
text: Text of the testimonial 3
title: Name of the person
\ No newline at end of file
items:
-
text: Text of the testimonial 1
text: Text of the testimonial 1 (loc data/testimonials.yml)
title: Name of the person
-
text: Text of the testimonial 2
......
......@@ -10,9 +10,18 @@
SPDX-License-Identifier: EPL-2.0
-->
<!-- Allow for alt sources and languages -->
{{ $source := .Get "source" | default "testimonials" }}
{{ $languageBase := index .Site.Data .Site.Language.Lang }}
<!-- Get the base of the testimonials by checking existence in localized section -->
{{ $base := index .Site.Data $source}}
{{ if and (ne $languageBase nil) (isset $languageBase $source) }}
{{ $base = index $languageBase $source }}
{{ end }}
<div class="row testimonial-container">
{{ range .Site.Data.testimonials.items}}
{{ range $base.items}}
<div class="col-sm-8 margin-bottom-20 testimonial-item">
<div style="background-color:#f1f3f7;" class="padding-20">
<p>"{{ .text }}"</p>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment