By senzaesclusiva on
As the title says, I just need to translate the days and months, and it seems a bit excessive to install two modules.
Many years ago, I managed to do this with some code tweaks and a preprocess in *.theme, but I can’t seem to find it anymore.
Does anyone know how to do this?
Many thanks to anyone who can help me
Comments
It would be helpful if you
It would be helpful if you shared more information, like where those strings are coming from, and being displayed.
Hi @ressa, sorry for the
Hi @ressa, sorry for the confusion; I thought everyone would understand what seemed so obvious to me (but in the end it wasn't that obvious after all, since the date can be necessary in so many contexts)!
In short, in the most common case of a content site: I need the creation date of each individual node :)
Thanks for your interest, and sorry again
No problem, it could have
No problem, it could have been anywhere, like in a View, or a block, etc. :)
Since dates are dynamic, this could be complicated ... Adding multilingual support is probably the correct method.
I did a quick experiment in the Twig file /core/themes/olivero/templates/content/node.html.twig, using a not very elegant method, but it worked:
Hi @ressa, sorry for late.
Hi @ressa, sorry for late.
I did this test too, and it work :) I'm trying to build a light module to do this task with months.
Not very elegant, but 'more elegant' than fighting against Drupal's APIs ;)
Many thanks
No problem @senzaesclusiva,
No problem @senzaesclusiva, and great that you got it working :) A custom module could be a solution, or a custom template Twig-file in a sub-theme.