Skip to content

Commit

Permalink
Added i18n support
Browse files Browse the repository at this point in the history
  • Loading branch information
eko committed Oct 28, 2017
1 parent 59bd5a3 commit 09e0686
Show file tree
Hide file tree
Showing 195 changed files with 331 additions and 118 deletions.
7 changes: 4 additions & 3 deletions .gitignore
@@ -1,3 +1,4 @@
_site
.sass-cache
Gemfile.lock
/_site
/.sass-cache
/Gemfile.lock
/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 @@ -7,6 +7,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
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
11 changes: 11 additions & 0 deletions _algolia.yml
@@ -0,0 +1,11 @@
# ALGOLIA
algolia:
application_id: '5IGTHBX5JS'
index_name: 'blog_eleven'
excluded_files:
- amp

# Trick to only build default site (and not each language)
default_lang: fr
languages: ["fr"]
exclude_from_localizations: ["authors", "css", "fonts", "img", "js", "_posts"]
24 changes: 8 additions & 16 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 @@ -55,14 +61,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_email: Email
str_next: Suivant
str_prev: Précédent
str_continue_reading: Lire l'article

# Post navigation
post_navigation: false

Expand All @@ -73,13 +71,6 @@ theme_settings:
paginate: 10
paginate_path: "/blog/page:num"

# ALGOLIA
algolia:
application_id: '5IGTHBX5JS'
index_name: 'blog_eleven'
excluded_files:
- amp

exclude: [vendor, _authors/TEMPLATE-AUTOR]

# BUILD SETTINGS
Expand All @@ -90,6 +81,7 @@ sass:
style: :compressed
plugins:
- jekyll-paginate
- jekyll-multiple-languages-plugin
- jekyll-seo-tag
- algoliasearch-jekyll
- jekyll-feed
Expand Down
10 changes: 10 additions & 0 deletions _i18n/en.yml
@@ -0,0 +1,10 @@
global:
contact_us: Contact us
follow_us_on: Follow us on
rss_follow: Add us to your watch
email: Email
next: Next
prev: Previous
continue_reading: Read article
newsletter_subscribe: Subscribe to our newsletter!
search_input: Search
10 changes: 10 additions & 0 deletions _i18n/fr.yml
@@ -0,0 +1,10 @@
global:
contact_us: Nous contacter
follow_us_on: Suivez-nous sur
rss_follow: Ajoutez-nous à votre veille
email: Email
next: Suivant
prev: Précédent
continue_reading: Lire l'article
newsletter_subscribe: Abonnez-vous à notre newsletter !
search_input: Rechercher
10 changes: 5 additions & 5 deletions _includes/amp-icons.html
@@ -1,6 +1,6 @@
{% 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 }}">
<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" width="12" height="12"></amp-img>
</a>
</li>
Expand All @@ -16,31 +16,31 @@

{% if include.data.github %}
<li>
<a class="no-link-style" href="https://github.com/{{ include.data.github }}" title="{{ include.data.str_follow_on }} GitHub">
<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" 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">
<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" 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">
<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" 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">
<a class="no-link-style" href="{{ include.data.linkedin }}" title="{% translate global.follow_us_on %} LinkedIn">
<amp-img src="/img/follow/linkedin.svg" width="12" height="12"></amp-img>
</a>
</li>
Expand Down
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
Expand Up @@ -13,7 +13,7 @@
{% else %}
,
{% endif %}
<a class="author-link" href="{{ '/authors/:author' | prepend: site.baseurl | replace: '//', '/' | replace: ':author', author }}">{{ existingAuthor.title }}</a>
<a class="author-link" href="{{ '/authors/:author' | prepend: site.baseurl_root | replace: '//', '/' | replace: ':author', author }}">{{ existingAuthor.title }}</a>
{% endif %}
{% endfor %}
{% endfor %}
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
18 changes: 17 additions & 1 deletion _includes/header.html
Expand Up @@ -10,11 +10,27 @@ <h1 class="site-title visually-hidden">
{% include search.html %}

<nav class="site-nav">
<!-- Language switcher -->
<ul>
{% for language in site.languages %}
{% if language != site.lang %}
{% if site.default_lang != language %}
{% assign link = language %}
{% endif %}
<li>
<a class="page-link no-link-style" href="/{{ link }}">
<img src="/img/flags/{{ language }}.png" alt="{{ language }}" title="{{ language }}" />
</a>
</li>
{% endif %}
{% endfor %}
</ul>

<ul>
{% 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>
Expand Down

0 comments on commit 09e0686

Please sign in to comment.