How to properly display jalali dates for Persian language

I haven’t done translations before, however - my understanding is that…

All translations are supplied via Discourse localization

This at some point then is migrated into client and server files in the Discourse repo where the English versions are these:
discourse/client.en.yml at main · discourse/discourse · GitHub
discourse/server.en.yml at main · discourse/discourse · GitHub

This topic covers this in more detail:

Note that there is a whole dates section in each of these files which comes from Transiflex:


Again hopefully someone with more knowledge will correct me if wrong…

As I see it you should submit the "jYYYY etc translations to Discourse localization

Moment.js will then be called with the right “jYYYY” etc instead of “YYYY”

Then you need to submit two extra code patches / Pull Requests to Discourse to add and call the extra libraries as needed:

  1. One Pull Request to add and load moment-jalaali if, an only if “jYYYY” etc are used.
  2. 2nd Pull Request for handling any dates etc which are handled via Ruby.

Following the translation and then first pull request should get you most of the way there.

One of the Discourse team will read this at some point (they read everything here) and may comment on if this is acceptable or if they have a better idea for a way forward.

6 Likes