Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Get the right language for the date?
Hi there!
My blog is entirely edited in French.
How could I get the date in French?
Thanks in advance for the tip!
Cheers!
If destiny is against us, just too bad for it!
Offline
#2 2009-06-17 15:46:35
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Get the right language for the date?
If you have installed French and made it your active language (Admin > Preferences > Language) you should get dates in French.
Offline
Offline
Re: Get the right language for the date?
Thanks for your replies!
Question is how to have these French locales installed?
I host my blog on my own computer (Mac mini running Mac OS X 10.5.7)
Regards,
Gerard
If destiny is against us, just too bad for it!
Offline
#5 2009-06-18 09:35:49
- gerhard01
- Plugin Author
- Registered: 2006-12-07
- Posts: 108
Re: Get the right language for the date?
Els wrote:
If you have installed French and made it your active language (Admin > Preferences > Language) you should get dates in French.
In my case, that did not work either. This snippet did the trick to display German date format instead of the standard English one:
<txp:php> global $locale; setlocale(LC_ALL, 'de_DE'); echo posted(array('format' => '%d. %B %Y')); setlocale(LC_ALL, $locale); </txp:php>
Offline
Re: Get the right language for the date?
Thanks for the code!
But, excuse the newbie, how do I use it?
Where does it take place ?
Cheers!
If destiny is against us, just too bad for it!
Offline
#7 2009-06-18 12:23:22
- gerhard01
- Plugin Author
- Registered: 2006-12-07
- Posts: 108
Re: Get the right language for the date?
Offline
#8 2009-06-18 12:29:08
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Get the right language for the date?
You put this where the date shall appear, as a replacement for the posted tag. Use these to format the display and replace posted on line 4 by modified if you actually wanted to use the modified tag.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Get the right language for the date?
Sorry if I seem so dumb to all of you but I didn’t find the file to be modified with:
<txp:php>
global $locale;
setlocale(LC_ALL, ‘fr_FR’);
echo posted(array(‘format’ => ‘%d. %B %Y’));
setlocale(LC_ALL, $locale);
</txp:php>
Where does the date shell appears?
If destiny is against us, just too bad for it!
Offline
#10 2009-06-18 18:46:44
- gerhard01
- Plugin Author
- Registered: 2006-12-07
- Posts: 108
Re: Get the right language for the date?
As uli has already pointed out, replace the <txp:posted /> tag by the php snippet in your (article) form (= what you denoted as “file”). Forms are accessible via Presentation > Forms in the TXP admin interface
Offline
#11 2009-06-18 19:40:06
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: Get the right language for the date?
And a cool tool to find all of the txp:posted or txp:modified tags in all of your forms (and pages) is smd_where_used, a plugin that’s installed via Administration > Plugins
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Get the right language for the date?
Wow! So simple…
(and so silly of me!)
Thank you “gerhard01” for the explanation.
“uli”, I’ll have a look at this plug-in tomorrow and give you some feedback.
Thank you too for your help!
Cheers to both of you!
If destiny is against us, just too bad for it!
Offline