organicmaps / organicmaps.github.io

Official Organic Maps website source code. Please contribute your translations!
Apache License 2.0
35 stars 34 forks source link

Date is not localized #124

Open matheusgomesms opened 1 year ago

matheusgomesms commented 1 year ago

Minor improvement: on News section, the date is not localized. No matter the language, it is displayed in English language and format (February 14, 2023, for example).

biodranik commented 1 year ago

Tera's date doesn't localize dates yet :( https://tera.netlify.app/docs/#date https://github.com/Keats/tera/issues/612

A patch can be done to localize it in the browser using JavaScript, or maybe some other hacky solution at the generation time.

biodranik commented 12 months ago

This approach can be tried:

cat templates/localized_date.html 
{% set dateFormat = trans(key="date-format", lang=lang) %}
{% set dateLocale = trans(key="date-locale", lang=lang) %}
{{ resource.date | date(format=dateFormat, locale=dateLocale) }}