Date format in my language

Hi,
I installed Kirby in my language (Italian).
My hosting time zone is set in Europe/Rome

The problem I would like to solve is the frontend side. The template I am using uses:

<time datetime="<?= $article->date('c') ?>"><?= $article->date('jS F Y') ?></time>

showing the date in this format: 15th January 2016
in my language I should display: 15 Gennaio 2016

I partly solved modifying from jS F Y to d m Y

in this way I visualize this format: 15 01 2018
It’s acceptable, however I would like to display the name of the month, but in my language.
I have read some discussions and it seems that I should use strftime, in config.php I added:

c::set('date.handler', 'strftime');

but i do not know how to convert, insert strftime:

<time datetime="<?= $article->date('c') ?>"><?= $article->date('jS F Y') ?></time>

I have done a lot of tests but, when it works, I read the names of the months in English.

thank you so much

The date format for strftime is different, see the PHP docs: http://php.net/manual/de/function.strftime.php

Too complex for my poor PHP skills but I made this attempt
from:
<?= $article->date('jS F Y') ?>
to:
<?= strftime ($article->date('%A %d %B %Y')) ?>

it’s already a good point, but the names of the months and days of the week are still in English.
is that I’m a bit confused and I might think it’s a problem of my installation or maybe Kirby can not read the format of my Hosting.

Have you set the locale in your config.php file:

c::set('locale', 'it_IT'); //this might have to be different, depending on your server settings
3 Likes

oh damn … you’re right, now I see the names in my language, thank you!

If it can be of interest, I have discovered errors in accented letters, for example the translation of Friday into my language: Venerdì

I solved by adding UTF-8, as follows:
it_IT.UTF-8

This also resolved

Molto bene :slight_smile: (and some more chars)

1 Like