elvina Posted December 29, 2024 Share Posted December 29, 2024 Hi Bernhard I tried to use the Latte localDate filter in a latte template and I get "Filter not defined". Is there a list of latte filters that are included? I'm just trying to get my date fields to translate as I can't get months to translate without using strftime() which is now depreciated. thanks Link to comment Share on other sites More sharing options...
bernhard Posted December 29, 2024 Share Posted December 29, 2024 RockFrontend includes the HumanDates library that you can use as strftime alternative: $rockfrontend->humandates('de_AT')->format('2025-01-01', 'd. MMMM y') // 1. Jänner 2025 https://github.com/baumrock/HumanDates Link to comment Share on other sites More sharing options...
cwsoft Posted December 29, 2024 Share Posted December 29, 2024 (edited) If it‘s just one language and one or two spots you need to deal with month or weekday names, I tend to use an array with e.g. the month names defined in the Latter template in combination with a PHP date format string like „n“ used as array index pointing to the month name needed (or „N“ for the weekday number). Edited December 29, 2024 by cwsoft Link to comment Share on other sites More sharing options...
elvina Posted Saturday at 03:05 AM Author Share Posted Saturday at 03:05 AM On 12/29/2024 at 9:46 PM, bernhard said: RockFrontend includes the HumanDates library that you can use as strftime alternative: $rockfrontend->humandates('de_AT')->format('2025-01-01', 'd. MMMM y') // 1. Jänner 2025 https://github.com/baumrock/HumanDates Thanks! I'll have a go with that, though I did manage to get the inbuilt PW date translation to work. I had been using date() but realised i need to use $datetime->date() (as well as put translations in the WireDateTime.php file) Oooh actually I need ranges too so HumanDates will be very useful. Cheers! 1 Link to comment Share on other sites More sharing options...
JamesFletcher Posted Saturday at 10:05 AM Share Posted Saturday at 10:05 AM I also had the same problem, what can I do? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now