Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2013-03-20 04:06:57
- bashirnoori
- Member
- From: Afghanistan
- Registered: 2012-10-02
- Posts: 79
[request] Localize Calendar Date Format
Hello,
As I’ve posted a question on the forum which didn’t solved my needed : http://forum.textpattern.com/viewtopic.php?id=39492
Some of my clients needed localize website on their own national language like Arabic or Persian.
So I’m trying to localize the calendar date format from Gregorian to Persian or Hijri, but still not success to do !
Any way please help me.
Thanks
Offline
Re: [request] Localize Calendar Date Format
I don’t know if this could work for you, but I localize the date format with the plugin rah_replace. In my case I replace the English names of months with the corresponding Dutch names. Done!
…Prrrrrrrr…
Offline
Re: [request] Localize Calendar Date Format
I would precise that installing missing server locales or ICU extension is not an option here (insufficient rights).
Offline
Re: [request] Localize Calendar Date Format
Hi Bashir,
From your original post I understand that you also wish to do away with CE (Common Era) and show the Solar Hijri calendar as far as year is concerned which might make things more difficult.
Maybe one of the plugin authors would know how to go about it.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#5 2013-03-23 04:34:33
- bashirnoori
- Member
- From: Afghanistan
- Registered: 2012-10-02
- Posts: 79
Re: [request] Localize Calendar Date Format
Yes Colak, you right i need such a thing if possible please help me, thank you
Offline
Re: [request] Localize Calendar Date Format
Hi Bashir,
here is a minimal plugin to output Hijri dates. After installing, please replace months’ names in the plugin code by Farsi translations.
YToxMTp7czo0OiJuYW1lIjtzOjg6ImV0Y19kYXRlIjtzOjY6ImF1dGhvciI7czoxNDoiT2xl
ZyBMb3VraWFub3YiO3M6MTA6ImF1dGhvcl91cmkiO3M6MzY6Imh0dHA6Ly93d3cuaXV0LWZi
bGVhdS5mci9wcm9qZXQvZXRjLyI7czo3OiJ2ZXJzaW9uIjtzOjM6IjAuMSI7czoxMToiZGVz
Y3JpcHRpb24iO3M6MTU6IkxvY2FsaXplZCBkYXRlcyI7czo0OiJjb2RlIjtzOjI3NjU6Ii8q
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KCQk8bGk+PHN0cm9uZz5kYXRl
PC9zdHJvbmc+OiA8Y29kZT5wb3N0ZWQ8L2NvZGU+LCA8Y29kZT5tb2RpZmllZDwvY29kZT4s
IDxjb2RlPmV4cGlyZXM8L2NvZGU+LCBzb21lIEVuZ2xpc2ggZGF0ZSwgb3I8L2xpPgoJCTxs
aT48c3Ryb25nPnRpbWVzdGFtcDwvc3Ryb25nPjogdGltZXN0YW1wPC9saT4KCTwvdWw+CgoJ
PGg0PkV4YW1wbGU8L2g0PgoKCTxwPjxjb2RlPiZsdDt0eHA6ZXRjX2RhdGUgZGF0ZT0mcXVv
dDtwb3N0ZWQmcXVvdDsgLyZndDs8L2NvZGU+IChyZXBsYWNlcyA8Y29kZT4mbHQ7dHhwOnBv
c3RlZCAvJmd0OzwvY29kZT4gaW4gYXJ0aWNsZSBmb3JtKSwgb3IgPGNvZGU+Jmx0O3R4cDpl
dGNfZGF0ZSBkYXRlPSZxdW90O25leHQgRnJpZGF5JnF1b3Q7IC8mZ3Q7PC9jb2RlPi48L3A+
IjtzOjM6Im1kNSI7czozMjoiYzA3ZmQ3OTA5NTNlYzU0Nzk1OTAyNjVjYzQwMzk4NDMiO30=
Please let me know how it works, but don’t blame me if something is inaccurate, it’s Google.
Last edited by etc (2013-03-25 15:09:44)
Offline
Offline
#8 2013-03-27 16:41:20
- bashirnoori
- Member
- From: Afghanistan
- Registered: 2012-10-02
- Posts: 79
Re: [request] Localize Calendar Date Format
Hi Thank you for your cooperation :-)
That’s good for Arabic and could you please make for Farsi as well (fa_IR) to output: 1392,
I think there are two kind of Hijri
one is 1392 and another is 1434
Thanks a lot
Offline
Re: [request] Localize Calendar Date Format
I will need your help for this, I’m afraid. :) How do you calculate dates in 1392 Hijri, is it just 1434 – 42? I know very little about it, sorry.
Offline
Offline
#11 2013-04-01 16:40:39
- raminrahimi
- Member
- From: India
- Registered: 2013-03-19
- Posts: 278
Re: [request] Localize Calendar Date Format
I think what Bashir needs is Jalali Date, that’s a useful plugin, I need that too for some of my clients.
But I don’t think that’s absolutely correct right now plugin which i installed, because there shows 4th (april) month and for Jalali is first.
They have different months like now their date is:
Now —> Hijri (Jalali) : 13/01/1892
Now —> Gregorian : 2/04/2013
Dear Oleg, please have a look to these links I’m sure that can help you further:
=> http://en.wikipedia.org/wiki/Iranian_calendars
=> http://en.wikipedia.org/wiki/Solar_Hijri_calendar
Offline
Re: [request] Localize Calendar Date Format
Ramin, thank you for your interest and report. I think, the calendars are correct, but I have forgotten to treat some formats, for example, abbreviated month names (%b
) used by Textpattern in default archive dates. That’s done now (v.0.2.6), please test. I am getting right results according to this site, but four eyes is better than two.
Offline