Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added i18n support #262

Merged
merged 1 commit into from Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
_site
.sass-cache
vendor
2 changes: 1 addition & 1 deletion 404.html
Expand Up @@ -15,7 +15,7 @@ <h3 class="read-also-title">Derniers articles :</h3>
<ul class="posts read-also-list">
{% for post in site.posts limit:5 %}
<li class="read-also-item">
<a class="read-also-link" href="{{ post.url | prepend: site.baseurl }}">
<a class="read-also-link" href="{{ post.url | prepend: site.baseurl_root }}">
{{ post.title }}
</a>
</li>
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -8,6 +8,7 @@ group :jekyll_plugins do
gem 'algoliasearch-jekyll', '~> 0.9.0'
gem 'elevenlabs-amp-jekyll', '~> 1.1.0'
gem 'jekyll-feed', '~> 0.9.2'
gem 'jekyll-multiple-languages-plugin', :git => 'git://github.com/eko/jekyll-multiple-languages-plugin.git'
gem 'jekyll-paginate', '~> 1.1.0'
gem 'jekyll-seo-tag', '~> 2.3.0'
end
Expand Down
10 changes: 9 additions & 1 deletion Gemfile.lock
@@ -1,3 +1,10 @@
GIT
remote: git://github.com/eko/jekyll-multiple-languages-plugin.git
revision: ac72749206194a11e2614c9d8e26c77d5fcf560e
specs:
jekyll-multiple-languages-plugin (1.5.1)
jekyll (>= 2.0, < 4.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -81,11 +88,12 @@ DEPENDENCIES
elevenlabs-amp-jekyll (~> 1.1.0)
jekyll (~> 3.6.2)
jekyll-feed (~> 0.9.2)
jekyll-multiple-languages-plugin!
jekyll-paginate (~> 1.1.0)
jekyll-seo-tag (~> 2.3.0)
rake
rouge (~> 2.2.1)
scss_lint

BUNDLED WITH
1.15.4
1.16.0.pre.3
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -26,7 +26,7 @@ end
# push to algolia
task :algolia_push do
if ENV['TRAVIS_BRANCH'] == 'master' && ENV['TRAVIS_PULL_REQUEST'] == "false"
jekyll('algolia push')
jekyll('algolia push --config _config.yml,_algolia.yml')
end
end

Expand Down
14 changes: 14 additions & 0 deletions _algolia.yml
@@ -0,0 +1,14 @@
# ALGOLIA
algolia:
application_id: '5IGTHBX5JS'
index_name: 'blog_eleven'
excluded_files:
- index.html
- amp
- authors
- page

# Trick to only build default site (and not each language)
default_lang: fr
languages: ["fr"]
exclude_from_localizations: ["authors", "css", "fonts", "img", "js", "_posts"]
1 change: 1 addition & 0 deletions _authors/vcomposieux.md
Expand Up @@ -2,6 +2,7 @@
layout: author
login: vcomposieux
title: Vincent Composieux
github: eko
twitter: vcomposieux
permalink: /authors/vcomposieux/
---
Expand Down
28 changes: 8 additions & 20 deletions _config.yml
Expand Up @@ -14,7 +14,13 @@ social:
- https://www.youtube.com/channel/UCt_NukjmUm4whjmbMuZ0MMw
- https://github.com/eleven-labs
- https://stackoverflow.com/jobs/companies/eleven-labs
baseurl:
baseurl: ""

# LANGUAGE-SPECIFIC CONFIGURATION
default_lang: fr
languages: ["fr", "en"]
exclude_from_localizations: ["authors", "css", "fonts", "img", "js"]
localized_posts_dir: _posts

# THEME-SPECIFIC CONFIGURATION
theme_settings:
Expand Down Expand Up @@ -57,15 +63,6 @@ theme_settings:
disqus_shortname: blog-eleven-labs
muut_community_name:

# Localization strings
str_follow_on: Suivez-nous sur
str_rss_follow: Ajoutez-nous à votre veille
str_corporate: Découvrez Eleven Labs
str_email: Email
str_next: Suivant
str_prev: Précédent
str_continue_reading: Lire l'article

# Post navigation
post_navigation: false

Expand All @@ -76,16 +73,6 @@ theme_settings:
paginate: 10
paginate_path: "/page/:num"

# ALGOLIA
algolia:
application_id: '5IGTHBX5JS'
index_name: 'blog_eleven'
excluded_files:
- index.html
- amp
- authors
- page

# BUILD SETTINGS
markdown: kramdown
highlighter: rouge
Expand All @@ -94,6 +81,7 @@ sass:
style: :compressed
plugins:
- jekyll-paginate
- jekyll-multiple-languages-plugin
- jekyll-seo-tag
- algoliasearch-jekyll
- jekyll-feed
Expand Down
30 changes: 30 additions & 0 deletions _i18n/en.yml
@@ -0,0 +1,30 @@
global:
also_read: You can also read
author_by: by
contact_us: Contact us
continue_reading: Read article
corporate: Discover Eleven Labs
email: Email
estimated_reading_time: Estimated reading time
follow_us_on: Follow us on
language_switch_to: Changer vers Français
next: Next
newsletter_subscribe: Subscribe to our newsletter!
prev: Previous
reading: Reading time
rss_follow: Add us to your watch
search_input: Search
date:
months:
january: January
february: February
march: March
april: April
may: May
june: June
july: July
august: August
september: September
october: October
november: November
december: December
30 changes: 30 additions & 0 deletions _i18n/fr.yml
@@ -0,0 +1,30 @@
global:
also_read: À lire aussi
author_by: par
contact_us: Nous contacter
continue_reading: Lire l'article
corporate: Découvre Eleven Labs
email: Email
estimated_reading_time: Temps de lecture estimé
follow_us_on: Suivez-nous sur
language_switch_to: Switch to English
next: Suivant
newsletter_subscribe: Abonnez-vous à notre newsletter !
prev: Précédent
reading: Lecture
rss_follow: Ajoutez-nous à votre veille
search_input: Rechercher
date:
months:
january: Janvier
february: Février
march: Mars
april: Avril
may: Mai
june: Juin
july: Juillet
august: Août
september: Septembre
october: Octobre
november: Novembre
december: Décembre
26 changes: 13 additions & 13 deletions _includes/amp-icons.html
@@ -1,55 +1,55 @@
{% if include.data.rss %}
<li>
<a class="no-link-style" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" title="{{ include.data.str_rss_follow }}">
<amp-img src="{{ "/img/follow/rss.svg" | prepend: site.baseurl }}" width="12" height="12"></amp-img>
<a class="no-link-style" href="{{ "/feed.xml" | prepend: site.baseurl_root | prepend: site.url }}" title="{% translate global.rss_follow %}">
<amp-img src="{{ "/img/follow/rss.svg" | prepend: site.baseurl_root }}" width="12" height="12"></amp-img>
</a>
</li>
{% endif %}

{% if include.data.email_address %}
<li>
<a class="no-link-style" href="mailto:{{ include.data.email_address }}" title="{{ include.data.str_email }}">
<amp-img src="{{ "/img/follow/envelope.svg" | prepend: site.baseurl }}" width="12" height="12"></amp-img>
<amp-img src="{{ "/img/follow/envelope.svg" | prepend: site.baseurl_root }}" width="12" height="12"></amp-img>
</a>
</li>
{% endif %}

{% if include.data.github %}
<li>
<a class="no-link-style" href="https://github.com/{{ include.data.github }}" title="{{ include.data.str_follow_on }} GitHub">
<amp-img src="{{ "/img/follow/github.svg" | prepend: site.baseurl }}" width="12" height="12"></amp-img>
<a class="no-link-style" href="https://github.com/{{ include.data.github }}" title="{% translate global.follow_us_on %} GitHub">
<amp-img src="{{ "/img/follow/github.svg" | prepend: site.baseurl_root }}" width="12" height="12"></amp-img>
</a>
</li>
{% endif %}

{% if include.data.twitter %}
<li>
<a class="no-link-style" href="https://twitter.com/{{ include.data.twitter }}" title="{{ include.data.str_follow_on }} Twitter">
<amp-img src="{{ "/img/follow/twitter.svg" | prepend: site.baseurl }}" width="12" height="12"></amp-img>
<a class="no-link-style" href="https://twitter.com/{{ include.data.twitter }}" title="{% translate global.follow_us_on %} Twitter">
<amp-img src="{{ "/img/follow/twitter.svg" | prepend: site.baseurl_root }}" width="12" height="12"></amp-img>
</a>
</li>
{% endif %}

{% if include.data.facebook %}
<li>
<a class="no-link-style" href="https://www.facebook.com/{{ include.data.facebook }}" title="{{ include.data.str_follow_on }} Facebook">
<amp-img src="{{ "/img/follow/facebook.svg" | prepend: site.baseurl }}" width="12" height="12"></amp-img>
<a class="no-link-style" href="https://www.facebook.com/{{ include.data.facebook }}" title="{% translate global.follow_us_on %} Facebook">
<amp-img src="{{ "/img/follow/facebook.svg" | prepend: site.baseurl_root }}" width="12" height="12"></amp-img>
</a>
</li>
{% endif %}

{% if include.data.linkedin %}
<li>
<a class="no-link-style" href="{{ include.data.linkedin }}" title="{{ include.data.str_follow_on }} LinkedIn">
<amp-img src="{{ "/img/follow/linkedin.svg" | prepend: site.baseurl }}" width="12" height="12"></amp-img>
<a class="no-link-style" href="{{ include.data.linkedin }}" title="{% translate global.follow_us_on %} LinkedIn">
<amp-img src="{{ "/img/follow/linkedin.svg" | prepend: site.baseurl_root }}" width="12" height="12"></amp-img>
</a>
</li>
{% endif %}

{% if include.data.corporate %}
<li>
<a class="no-link-style" href="{{ include.data.corporate }}" title="{{ include.data.str_corporate }}">
<amp-img src="{{ include.data.corporate_logo | prepend: site.baseurl }}" width="12" height="12"></amp-img>
<a class="no-link-style" href="{{ include.data.corporate }}" title="{% translate global.corporate %}">
<amp-img src="{{ include.data.corporate_logo | prepend: site.baseurl_root }}" width="12" height="12"></amp-img>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'est quoi la difference entre site.baseurl et site.baseurl_root ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si tu ne mets pas ça, le site va récupérer l'image dans https://blog.eleven-labs.com/en/img au lieu de https://blog.eleven-labs.com/img

</a>
</li>
{% endif %}
2 changes: 1 addition & 1 deletion _includes/amp.scss
@@ -1,5 +1,5 @@
// jekyll variables
$baseurl: '{{ site.baseurl }}';
$baseurl: '{{ site.baseurl_root }}';

// Settings
@import 'settings/variables';
Expand Down
2 changes: 1 addition & 1 deletion _includes/author_link.html
@@ -1,5 +1,5 @@
<!-- _includes/author_link.html -->
- par
- {% translate global.author_by %}

{% for author in include.authors %}
{% assign isFirstAuthor = forloop.first %}
Expand Down
22 changes: 22 additions & 0 deletions _includes/date_translate.html
@@ -0,0 +1,22 @@
<!-- _includes/date_translate.html -->
{% if site.lang != 'en' %}
{% assign month = include.object | date: "%-m" %}
{{ include.object | date: "%-d" }}
{% case month %}
{% when '1' %}{% translate date.months.january %}
{% when '2' %}{% translate date.months.february %}
{% when '3' %}{% translate date.months.march %}
{% when '4' %}{% translate date.months.april %}
{% when '5' %}{% translate date.months.may %}
{% when '6' %}{% translate date.months.june %}
{% when '7' %}{% translate date.months.july %}
{% when '8' %}{% translate date.months.august %}
{% when '9' %}{% translate date.months.september %}
{% when '10' %}{% translate date.months.october %}
{% when '11' %}{% translate date.months.november %}
{% when '12' %}{% translate date.months.december %}
{% endcase %}
{{ include.object | date: "%Y" }}
{% else %}
{{ include.object | date: "%B %-d, %Y" }}
{% endif %}
3 changes: 3 additions & 0 deletions _includes/disqus.html
@@ -1,5 +1,8 @@
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_config = function () {
this.language = '{{ site.lang }}';
};
var disqus_shortname = '{{ site.theme_settings.disqus_shortname }}';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
Expand Down
2 changes: 1 addition & 1 deletion _includes/footer.html
@@ -1,7 +1,7 @@
{% if site.theme_settings.footer_text %}
<footer class="slice site-footer">
<p class="text container">
<a href="mailto:contact@eleven-labs.com" title="Email">Nous contacter</a>
<a href="mailto:contact@eleven-labs.com" title="Email">{% translate global.contact_us %}</a>
<br />
{{ site.theme_settings.footer_text }}
</p>
Expand Down
18 changes: 9 additions & 9 deletions _includes/head.html
Expand Up @@ -8,27 +8,27 @@
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

<!-- CSS -->
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl_root }}">

<!-- Allow installing the app to the homescreen -->
<link rel="manifest" href="{{ "/manifest.json" | prepend: site.baseurl }}">
<link rel="manifest" href="{{ "/manifest.json" | prepend: site.baseurl_root }}">
<meta name="mobile-web-app-capable" content="yes">

<!-- iOS home screen icons -->
<meta name="apple-mobile-web-app-title" content="Blog Eleven Labs">
<link rel="apple-touch-icon" sizes="120x120" href="{{ "/img/icons/icon-120x120.png" | prepend: site.baseurl }}">
<link rel="apple-touch-icon" sizes="152x152" href="{{ "/img/icons/icon-152x152.png" | prepend: site.baseurl }}">
<link rel="apple-touch-icon" sizes="167x167" href="{{ "/img/icons/icon-167x167.png" | prepend: site.baseurl }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ "/img/icons/icon-180x180.png" | prepend: site.baseurl }}">
<link rel="apple-touch-icon" sizes="120x120" href="{{ "/img/icons/icon-120x120.png" | prepend: site.baseurl_root }}">
<link rel="apple-touch-icon" sizes="152x152" href="{{ "/img/icons/icon-152x152.png" | prepend: site.baseurl_root }}">
<link rel="apple-touch-icon" sizes="167x167" href="{{ "/img/icons/icon-167x167.png" | prepend: site.baseurl_root }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ "/img/icons/icon-180x180.png" | prepend: site.baseurl_root }}">

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="theme-color" content="#fbe300">

<!--Favicon-->
<link rel="shortcut icon" href="{{ "/img/icons/favicon.ico" | prepend: site.baseurl }}" type="image/x-icon">
<link rel="shortcut icon" href="{{ "/img/icons/favicon.ico" | prepend: site.baseurl_root }}" type="image/x-icon">

<!-- RSS -->
<link rel="alternate" type="application/atom+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" />
<link rel="alternate" type="application/atom+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl_root | prepend: site.url }}" />

<!-- Font Awesome -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
Expand All @@ -39,7 +39,7 @@
{% endif %}

{% if page.path contains '_posts' %}
<link rel="amphtml" href="{{ page.id | prepend: '/amp' | prepend: site.baseurl | prepend: site.url }}">
<link rel="amphtml" href="{{ page.id | prepend: '/amp' | prepend: site.baseurl_root | prepend: site.url }}">
{% endif %}
<!-- Google Analytics -->
{% if site.theme_settings.google_analytics %}
Expand Down
16 changes: 15 additions & 1 deletion _includes/header.html
Expand Up @@ -14,14 +14,28 @@ <h1 class="site-title visually-hidden">
{% for page in site.pages %}
{% if page.title and page.hide != true and page.path contains '_posts' %}
<li>
<a class="page-link no-link-style" href="{{ page.url | prepend: site.baseurl }}">
<a class="page-link no-link-style" href="{{ page.url | prepend: site.baseurl_root }}">
{{ page.title }}
</a>
</li>
{% endif %}
{% endfor %}
<!-- Social icons from Font Awesome, if enabled -->
{% include icons.html data=site.theme_settings %}

<!-- Language switcher -->
{% for language in site.languages %}
{% if language != site.lang %}
{% if site.default_lang != language %}
{% assign link = language %}
{% endif %}
<li class="language">
<a class="page-link no-link-style" href="{{ site.baseurl_root }}/{{ link }}">
<img src="{{ site.baseurl_root }}/img/flags/{{ language }}.svg" alt="{% translate global.language_switch_to %}" title="{% translate global.language_switch_to %}" width="18" height="12" />
</a>
</li>
{% endif %}
{% endfor %}
</ul>
</nav>
</header>