Hello, I’m really new to grav and I’m not sure yet how to use the variables provided.
What I want to do is to show “1 min ago”, “3 hours ago” , “7 days ago” instead of the long date. Is it possible somehow, can anyone help me?
page.date|nicetime()
-> 1 wk ago
oh, thank you so much!!! I feel stupid now >.<
do you by any chance know how to localize it?
I mean, is there a chance to override the translations provided by the system language settings? Because it translates into the wrong phase by default.
There is a default_locale
setting in system.yaml, as well as a override_locale
setting. In theory overriding this will allow PHP to translate common phrases, though I’m unsure of the linguistic coverage this offers, and haven’t tested it myself.
You can translate these strings https://github.com/getgrav/grav/blob/develop/system/languages/en.yaml#L58-L94 in https://crowdin.com/project/grav-core
Thanks a lot guys! I’m still learning grav, but its awesome!