How I can set the date generated by ditto 2 in my language, for example in italian?
I should use the
setlocale(LC_ALL, "it_IT");
Where to put this?
___________________________________________________________________
..:: Samuele ::..
For Ditto use parameter &dateFormat=`%d.%m.%y, %H:%M`. This way you can format the date any way you like it.
Other option is to execute setlocale anywhere prior the snippet execution.
Though it won’t work if the snippet uses its own date formatting functions.
I put my setlocale directly in snippet code or snippet language file.
I call this in my news page
The chunk {{news}} is
[!Ditto? &language=`italian` &tpl=`template-ditto` &parents=`[*id*]` &total=`all` &display=`4` &paginate=`1` &paginateAlwaysShowLinks=`1` &dateSource=`pub_date` &dateFormat=`%d %B %Y` !]
and the snippet [[data-it]] is
<?php
setlocale(LC_ALL, "it_IT");
//setlocale(LC_TIME,"it_IT");
?>
The output is always a date in english
___________________________________________________________________
..:: Samuele ::..
Put setlocale(LC_ALL, "it_IT"); in the italian language file.
___________________________________________________________________
..:: Samuele ::..
I try also to put the
setlocale(LC_ALL, "it_IT");
in Ditto snippet directly, but nothing.
Other solution?
___________________________________________________________________
..:: Samuele ::..
Can you create a manager user for me, so I can take a look?
I cannot understand what’s going on.
Mmm... the site is on localhost (vers. modx 0.9.5 - Ditto 2.0.2)
My problem is the date. For example, now the date is show as: "by Administrator on 11 April 2007".
Instead I want "by Administrator on 11 Aprile 2007". April in italian.
___________________________________________________________________
..:: Samuele ::..
Yes, my server running on Windows.
With your code it works. Thanks.
___________________________________________________________________
..:: Samuele ::..