Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-14 19:30:24

dkruitbosch
New Member
Registered: 2004-12-17
Posts: 9

Ho do I show dates in dutch

Hi,

I want to show my posted dates in dutch long format (e.g. 14 augustus 2005 instead of 14-8-2005), but keep my language settings in English. <txp:posted> has the format attribute, but it’s output depends on the LOCALE settings or some setlocale() php call. Is there any way to change this? Or is there a <txp:posted> plugin that supports a “lang” attribute?

Thanks,

Danny

Offline

#2 2006-02-14 23:33:20

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Ho do I show dates in dutch

Something like this might work:

global $locale;
setlocale(LC_ALL, 'nl_NL.UTF-8');
echo posted(array('format' => '%A %B %e %Y, %H:%M:%S'));
setlocale(LC_ALL, $locale);
</txp:php>

Change the format as required, see the faq for details. You might have to experiment with locale names, nl_NL.UTF-8 may not be supported on your system.

Last edited by zem (2006-02-14 23:40:10)


Alex

Offline

#3 2006-03-19 20:39:24

blumie607
Member
Registered: 2004-03-08
Posts: 175
Website

Re: Ho do I show dates in dutch

I tried using this with Hebrew (he_IL) and it didn’t work. Do you know why, maybe?

Thanks


bludrop studios .::. Creative Expression

Offline

#4 2006-06-22 18:19:48

blumie607
Member
Registered: 2004-03-08
Posts: 175
Website

Re: Ho do I show dates in dutch

It now works. Cool!


bludrop studios .::. Creative Expression

Offline

#5 2006-06-29 09:44:08

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,126
Website GitHub

Re: Ho do I show dates in dutch

As zem wrote, experimenting with several locale variations can help, as shown in the PHP setlocale page e.g. in my case de_DE would not work for German, but adding further options did:
setlocale(LC_ALL, 'de_DE', 'deu_deu');
In some cases the language name itself will work, e.g.
setlocale(LC_ALL, 'german');

Remember, though, a new host may have different locale settings, so you will need to check again when you transfer from a local to an online server.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB