Skip to main content

Articles tagged with "Twig"

Upgrading your website to Drupal 8 or 9

Part of the series
Upgrading to Drupal 9

Update: Since writing this article the EOL of Drupal 7 has been extended from November 2021 until November 2022.

Your current website/platform is built on Drupal 7 and news has hit your ears about 7’s end of life (EOL). Maybe your website is a Drupal 8 website and you want to know what the future has in store for you. Good news is, you don’t have to do anything immediately, but it is definitely a question that you want to start thinking about very soon.

This article is mainly aimed at Drupal 7 builds looking to upgrade to 8 or...

Read more

Localising dates in twig templates

14th Aug 2018

A client noticed the dates on their news articles were not being translated into the correct language. The name of the month would always appear in English, even though all the month names had themselves been translated and showed correctly elsewhere. The problem turned out to be down to the twig filter being used in the template to format the date. This is what we did have:

{% set newsDate = node.getCreatedTime|date('j F Y') %}
{% trans %} {{ newsDate }}{% endtrans %}

So this would produce something like '1 March 2018' instead of '1 März 2018' when...

Read more