I’ve installed Discourse on Ubuntu locally, outside of Docker. How can I convert the dates in the forum to Jalali dates?
Thanks
Would this help?
I don’t know if Discourse takes heed of such a specific localisation. Sorry!
Well I just found out Discourse supports locale modules. So somebody more knowledgeable than me will be able to guide you, I am, confident.
Thank you very much for answering.
No unfortunately.
What I meant was how can I convert the date of posts and other dates displayed in the forum from Gregorian to jalali.
You can set the Default Locale to Persian/Farsi in the Admin Settings interface. That might work.
There doesn’t seem to be a way for an individual Discourse user to set their preferred locale - I suppose their browser will send that information with each request. I see that Chrome offers a Language Setting which includes Persian. Maybe that will work.
Thank you very much for answering.
No unfortunately.
Ah, sorry it didn’t help. I think you may need some kind of plugin.
So @serkhelesheyi what exact locale is it that you want? Not obvious from your OP.
If it does not exist I believe locale modules are pluggable and somebody could write you one.
Also, as an aside, you will find support people here strongly recommend installing Discourse via Docker and are generally loth to help with non Docker installs, as any number of things could be different to the standard setup. Just by the way.
Changing locale to Iran/Farsi, the only difference it makes is that it shows the Gregorian months in Persian letters. What I want to do is to display the months of the Jalali calendar, not the Gregorian calendar.
If you have a budget, you could request some help on the marketplace.
No, unfortunately I don’t have a budget, but thank you very much for introducing marketplace.
I tried this at the command line
# locale-gen fa_IR.UTF-8
and now I seem to have something:
# date
Mon Dec 9 15:43:50 CET 2024
# env LC_TIME=fa_IR.utf8 date
<U+202B>دوشنبه ۰۹ دسامبر ۲۴، ساعت ۱۵:۴۳:۵۱ (CET)<U+202C>
But I can’t say if it is useful as I don’t have the language skill. (I suspect it’s the same as you saw, that the Gregorian date has been word-for-word translated)
Thank you very much
No, I don’t want that. This just displays the names of the months in Persian letters. What I want is to actually display the jalali month.
For example, in the text you mentioned, the word “دسامبر” is mentioned as a month, which is pronounced December in Persian (the twelfth month). What I want is to display the ninth month of the jalali calendar(I mean “Azar”(آذر) ).
Indeed. So, it looks to me that at the lowest unix system level there is nothing to help you. Therefore you do, unfortunately, need something in the application level - some kind of package, theme, or plugin for Discourse, which is used everywhere there’s a date.
Such functions certainly exist in JavaScript - (moment.js, day.js, date-fns) - but plumbing them into Discourse, if they are not already available, is a technical task, more than I could do myself.
Edit: I had a look, and it seems moment.js is already available, so this might not be so very difficult.
There is some information on this in
Yes. The solution is to use moment.js, but my problem is that I don’t know how to use it and I need someone to guide me from the beginning to the end.
Thank you very much for your guidance.
I have seen this post before but my problem is that I don’t know how to do this and I need someone to explain all the steps to me.
I notice a previous similar request:
Converter to change gregorian date to jalali on view layer of discourse
But more promising is this one:
Error in loading dashboard reports when using moment-jalaali.js
which links back to this earlier one
How to properly display jalali dates for Persian language
(edit: oops I see this was linked earlier)
I would recommend a change to the title of this topic, perhaps:
How to display all dates and times in Jalali (not Gregorian)
(I think what’s needed is purely in display - the actual timestamps in the database will not be changed. These timestamps will be seconds-since-1970)
Thank you very much for your suggestion and guidance.
I changed the title as suggested. Thanks!
Removed the unsupported-install tag - this question is unrelated to that fact. Though @serkhelesheyi I do recommend you install using the official install instructions to avoid other kinds of problems you might get into.
Looks like @osama answered this question over there. There is no supported way to display dates and times in Jalali (not Gregorian) but it could be implemented in a plugin if somebody had time and interest to do that.