How can I output a localized date in French using Liquid?

Topic summary

Goal: Output a French-localized date in Liquid, since the date filter (e.g., “%B %e, %Y”) returns English month/day names and has no built-in locale switch.

Update/solution: A manual workaround maps French month and weekday names to arrays, extracts parts of order.created_at, and reconstructs the date string in French.

  • Define arrays for months (janvier…décembre) and days (dimanche…samedi).
  • Parse order.created_at to “%Y-%m-%d”; slice year (0–4), month (5–2) then subtract 1 for zero-based indexing, and day (8–2).
  • Get weekday index via “%w” and index into the days array.
  • Output format: “weekday day month year” (e.g., lundi 05 février 2024).

Context: Applied for bilingual Shopify Order Printer receipts where default dates remained in English.

Notes: The code snippet (central to the discussion) handles accents in French names and relies on Liquid filters slice, split, minus, and date. Ensure month indexing uses minus: 1 to match 0-based arrays.

Status: Provides a practical, code-based workaround; no official localization setting was identified; effectively resolved via manual mapping.

Summarized with AI on December 27. AI used: gpt-5.

How would you output a localised date in Liquid? For example outputting this date in French?

{{ order.created_at | date: "%B %e, %Y" }}

Hey man, I’m obviously a little bit late to reply here, but I had the same issue with the new order printer. I was able to make a french and english version for the receitps I print but the date was always output in english.

With some help from ChatGPT here is the coding I added to replace the usualy created at liquid reference for the date

{% assign months = "janvier,février,mars,avril,mai,juin,juillet,août,septembre,octobre,novembre,décembre" | split: ',' %} {% assign days = "dimanche,lundi,mardi,mercredi,jeudi,vendredi,samedi" | split: ',' %} {% assign order_date = order.created_at | date: "%Y-%m-%d" %} {% assign year = order_date | slice: 0, 4 %} {% assign month = order_date | slice: 5, 2 | minus: 1 %} {% assign day = order_date | slice: 8, 2 %} {% assign day_of_week = order.created_at | date: "%w" %} {{ days[day_of_week] }} {{ day }} {{ months[month] }} {{ year }}