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.
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 ۱۰ شهریور ۱۴۰۵.
What changed:
_plugins/jalali-date.rbconverts Gregorian dates to Jalali and adds alocalized_datefilter- the four templates that print a date use
localized_dateinstead ofdate(post layout, news page, news sidebar and package page) tools/jalali-leap-years.txtis the official table of Jalali leap years and new year dates.tools/check-jalali-date.rbchecks the plugin against it for every single day from 1210 to 1498 (1831 to 2119), and runs in thepagesjob.
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!

