Fix broken dates on the Persian site and show them as Jalali dates

Hi!

The dates on the Persian site are broken at the moment. Every post on https://f-droid.org/fa/news/ shows something like "12d Sep 26", so the day is missing and the month is in English.

Screenshot_2026-09-10_at_15-26-56_News_اف_دروید_-_مخزن_کاره_های_نرم_افزار_آزاد_اندروید

This comes from the fa translation of news.date_format, which is %Id %b %Oy. Ruby's strftime reads %I as the hour (always 12, because posts are at midnight), prints the d as it is, and ignores the O.

Fixing that string would only get us a Gregorian date though. A lot of Persian speakers use the Jalali (Solar Hijri) calendar day to day, and that's the date they'd expect to see. So on the Persian site Sep 1, 2026 now shows up as ۱۰ شهریور ۱۴۰۵.

Screenshot_2026-09-10_at_15-26-12_News_اف_دروید_-_مخزن_کاره_های_نرم_افزار_آزاد_اندروید

What changed:

  • _plugins/jalali-date.rb converts Gregorian dates to Jalali and adds a localized_date filter
  • the four templates that print a date use localized_date instead of date (post layout, news page, news sidebar and package page)
  • tools/jalali-leap-years.txt is the official table of Jalali leap years and new year dates. tools/check-jalali-date.rb checks the plugin against it for every single day from 1210 to 1498 (1831 to 2119), and runs in the pages job.

Other languages don't change, they still get Liquid's normal date output, and there are no new gems. If a date ever falls outside that range, the plugin shows the Gregorian date instead of guessing.

One thing I'd like your opinion on: the Persian date format lives in the plugin rather than coming from news.date_format on Weblate. That string is written for Gregorian dates and its month names don't apply here. The catch is that translators can't change it anymore, so if you'd rather keep it on Weblate I'm happy to change that.

Thanks!

Edited by Goudarz Jafari

Merge request reports

Loading
Loading