Forum

Thread tagged as: Question

Language for date function

Is it possible to change the language for dates in the Blog app? We mostly do norwegian sites and would like to change for example months like "May" to "Mai". Can't find any translation for this function in the language file for Perch.

Erick Green

Erick Green 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use strftime formatting codes, which use your server's locale settings.

https://docs.grabaperch.com/docs/templates/attributes/format/

https://php.net/manual/en/function.strftime.php

Do you have a solution to make the first letter capital? Ive found an answer on stackoverflow but it uses php echo. Need to make this work with perch fieldtype "date".

https://stackoverflow.com/questions/10873562/strftime-make-first-letter-capital-uppercase-in-php

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not sure I have a solution for that.

Which locale are you using that is not correctly localising the capitalisation?

Im using "no_NO". It shows mandag but need it to show as Mandag. Ive tried some php replace but cant get it to work with perch date, only with php echo.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you use text-transform: capitalise; in your CSS?

Great suggestion. Worked with text-transform: capitalize; but needed the month name to be all lowercase. Fixed the problem with psudo :first-letter. Thanks! Where do I put the setlocal code to get Norwegian time format in Perch dashboard/cms as well?

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's a bunch of options you can set in your config.php file:

https://docs.grabaperch.com/docs/installing-perch/configuration/dates/