Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-03-16 05:16:29

bashirnoori
Member
From: Afghanistan
Registered: 2012-10-02
Posts: 64

How to Localize Date format

I want to localize the date format to Arabic or Persian language (Hijri Shamsi) like:
دوشنبه حمل 1391
Any one please help me,
Thanks

Offline

#2 2013-03-16 09:16:25

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: How to Localize Date format

bashirnoori wrote:

I want to localize the date format to Arabic or Persian language (Hijri Shamsi) like:
دوشنبه حمل 1391
Any one please help me,
Thanks

Is there localization available for your desired languages?

Then, try:

 Admin --> Basic --> Date Format

but before that install your language via e.g.

Admin --> Language --> Persian

Offline

#3 2013-03-16 09:33:50

bashirnoori
Member
From: Afghanistan
Registered: 2012-10-02
Posts: 64

Re: How to Localize Date format

I know that, but there i can see that old format (March, 22, 2013).

Offline

#4 2013-03-16 09:39:04

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: How to Localize Date format

bashirnoori wrote:

I know that, but there i can see that old format (March, 22, 2013).

No idea, here it works with my native (Croatian) language as set up.

Do you use any plugin which could spoil the party?

Offline

#5 2013-03-16 11:36:08

etc
Developer
Registered: 2010-11-11
Posts: 5,055
Website GitHub

Re: How to Localize Date format

If Persian locale is not installed on your server, there is not much you can do. Try to see whether <txp:php>echo setlocale(LC_ALL, 'fa_IR');</txp:php> outputs something.

Offline

#6 2013-03-18 05:02:07

bashirnoori
Member
From: Afghanistan
Registered: 2012-10-02
Posts: 64

Re: How to Localize Date format

Hi dear, i’m sorry i didn’t got your point, could you please guide me ?
Thanks

Offline

#7 2013-03-18 09:06:03

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: How to Localize Date format

Hi Bashir,

What Oleg is suggesting is that your server might not support farsi date formats. The way to check if it does is to paste his code in an article and post back here its results.

before pasting the code make sure that you have php enabled in articles. You can do that in Admin>Preferences>Advanced -> Allow PHP in pages?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2013-03-18 09:14:42

etc
Developer
Registered: 2010-11-11
Posts: 5,055
Website GitHub

Re: How to Localize Date format

Hi Bashir, and thank you, Yiannis, that’s what I meant indeed. Textpattern uses server locales (and not its own text strings) for date output. If the code above outputs fa_IR, then I am wrong, and the reason is somewhere else. If it outputs nothing, then fa_IR locale is not installed on the server, and Textpattern can not help it, you’ll have to ask your sysadmin.

Offline

#9 2013-03-18 10:04:53

bashirnoori
Member
From: Afghanistan
Registered: 2012-10-02
Posts: 64

Re: How to Localize Date format

Nothing display !

But I installed Arabic language and it will change all date format to Arabic Language like:
منشور الثلاثاء يناير 15, 2013
and i checked with: <txp:php>echo setlocale(LC_ALL, ‘ar_AR’);</txp:php>
also nothing appeared

I’ve used before Joomla CMS, that has a language file (fa-IR.ini) there we can change everything like name of the months, days, etc…

Offline

#10 2013-03-18 11:51:38

etc
Developer
Registered: 2010-11-11
Posts: 5,055
Website GitHub

Re: How to Localize Date format

That could be ar_DZ or ar_AR.utf8 or some other variant. Call <txp:php>passthru('locale -a');</txp:php> to list all available locales.

Offline

#11 2013-03-19 04:24:37

bashirnoori
Member
From: Afghanistan
Registered: 2012-10-02
Posts: 64

Re: How to Localize Date format

So it mean no way to localize the calender or change days + month names !
I will have different clients from different countries, they will need to appear the date format on their own languages, what to do !
I think that’s an important point for CMS that should be available, because i’ve used Joomla, Wordpress, Drupal all of them have that feature.

Offline

#12 2013-03-19 10:09:09

etc
Developer
Registered: 2010-11-11
Posts: 5,055
Website GitHub

Re: How to Localize Date format

bashirnoori wrote:

So it mean no way to localize the calender or change days + month names !
I will have different clients from different countries, they will need to appear the date format on their own languages, what to do !
I think that’s an important point for CMS that should be available, because i’ve used Joomla, Wordpress, Drupal all of them have that feature.

I guess locales are something more than just days/month names (think of Chinese calendars), but yes, that’s a problem. You can not always install a locale your client needs, so some kind of <txp:abc_local_date /> plugin might be welcome. I am bad on the admin side, so can not do it (quickly) myself, sorry. Probably, you should publish a plugin request, describing precisely your needs.

Offline

Board footer

Powered by FluxBB