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 January 4 Author Share Posted January 4 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 January 4 Share Posted January 4 (edited) On 12/29/2024 at 6:07 AM, elvina said: 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 Hi Bernhard, It seems that localDate isn’t a default filter in Latte. You can refer to the Latte documentation for a list of built-in filters. To translate date fields, you might consider using PHP’s `IntlDateFormatter` or creating a custom Latte filter for localized date formatting. My friend was studying business management and often faced challenges with their writing at all academic levels. As a supportive friend, I recommended using DoMyPaper for help with their essay writing. He decided to give https://domypaper.com/ a try and is completely satisfied with the service. DoMyPaper has a team of professional writers who assist their users with various writing needs. They offer services for all academic levels and are available 24/7. I also had the same problem, what can I do? Edit: Anyone? Edited 11 hours ago by JamesFletcher Link to comment Share on other sites More sharing options...
elvina Posted 7 hours ago Author Share Posted 7 hours ago Hi Are you asking about Latte filters or about using the PW date formatting? Link to comment Share on other sites More sharing options...
fliwire Posted 3 hours ago Share Posted 3 hours ago Navigate to site/modules/RockFrontend than run command. composer update latte/latte Link to comment Share on other sites More sharing options...
bernhard Posted 1 hour ago Share Posted 1 hour ago I've updated the module, thx. 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