How can I translate delivery dates into German on my product page?

Good day,

I have written a code on my product page that displays the effective delivery date (metafields in the product in working days), since it is a German shop, I would also like to have the date translated into German.

Do you have any advice on how I can solve the problem? Since I’ve already tried the translation in 2 variants, I don’t know of any other solution :slightly_smiling_face:

Error message:> Mittwoch, 19. Januar 2022 um 10:53 +0100 bis> translation missing: de.Sunday 30. January 2022> (The translation is okay in the 1st date, but the addition time and +0100 bothers me)

Code:

{% if product.metafields.my_fields.lieferzeitmin != blank %}> > {% assign delivery_day1 = product.metafields.my_fields.lieferzeitmin | times: 86400 %}> {% assign delivery_day2 = product.metafields.my_fields.lieferzeitmax | times: 86400 %}> > {{ “now” | date: “%s” | plus: delivery_day1 | date: de_DE: ‘abbreviated_date’ }}> > bis

{{ “now” | date: “%s” | plus: delivery_day2 | date: “%A %d. %B %Y” | t }}> {% else %}> {% endif %}


Language Code: (Code: Locales / de.json)

“WABEMA”: {> “date”: {> “Monday”: “Montag”,> “Tuesday”: “Montag”,> “Wednesday”: “Mittwoch”,> “Thursday”: “Donnerstag”,> “Friday”: “Freitag”,> “Saturday”: “Samstag”,> “Sunday”: “Sonntag”,> “January”: “Januar”> > …> }> },

Shop-Product site: Link

Thank you very much & have a nice day!
Markus

Hi @Wabema ,

You just need to change the code to display the date, it will automatically translate everything for you:

{{ “now” | date: “%s” | plus: delivery_day1 | time_tag: format: ‘date’ }}

Or if you want to change the date display format, you can follow these steps:

  • Step 1: Go to de.json and add code:
"date_formats": {
  "month_day_year": "%B %d, %Y",
  "day_month": "%d %B"
}
  • Step 2: Change the code to display the date:

{{ “now” | date: “%s” | plus: delivery_day1 | time_tag: format: ‘month_day_year’ }}

Hope it helps!