Blog 1

Random Talk on Random Thoughts

Basic Jekyll Date Locale Support

| Comments |

Problem

I tried installing _plugins/i18n_filter.rb and _locales/fr.yml from GitHub. I mistakenly thought that I had finished changing the English dates on Blog 2 to their corresponding French version due to the successful results shown in the local preview.

How can one get the locale support for dates on Jekyll sites?

Possible cause

It is possible that the jekyll gem installed on my computer was different to the one found on GitHub Pages’ server.

A Dirty Fix

With reference to this Stack Overflow question, I manually filled in the name of the months to create a French “support” for dates in sites built with Jekyll.

A minimum working example for customizing month names (index.md) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{% raw %}
<!-- delete the first line -->
---
layout: page
title: Mon 2ème blog
tagline: Mes petites notes de français
---
{% include JB/setup %}

C'est difiicile de chercher des mots dans un cahier ou dans un livre.
Heureusement, c'est facile de les rechercher sur Google.  Alors, je
fais ce blog-ci.

## Articles récents

Voici une petite liste des articles.

<ul class="posts">
  {% for post in site.posts limit:5 %}
    <li><span>{% assign m = post.date | date: "%-m" %}
      {{ post.date | date: "%-d" }}
      {% case m %}
	{% when '1' %}janvier
	{% when '2' %}février
	{% when '3' %}mars
	{% when '4' %}avril
	{% when '5' %}mai
	{% when '6' %}juin
	{% when '7' %}juillet
	{% when '8' %}août
	{% when '9' %}septembre
	{% when '10' %}octobre
	{% when '11' %}novembre
	{% when '12' %}décembre
      {% endcase %}
      {{ post.date | date: "%Y" }}
    </span> &raquo; <a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a></li>
  {% endfor %}
</ul>
<!-- delete the last line -->
{% endraw %}

Comments