Personalized checkout and custom promotions with Shopify Scripts
Hi!
Does someone have an idea on how to localize the liquid date filter?
I was hoping that inputing
{{ "Tuesday" | date: "%A" }}
Would output the correct translation of tuesday for the language the user is browsing the site in.
Thanks for your suggestions!
Solved! Go to the solution
This is an accepted solution.
Hi,
Liquid will do that for you, if you use the locale files. E.g.:
In en.default.json you define:
"date_formats": {
"month_day_year": "%b %d, %Y",
"weekday": "%A"
}
And in de.json:
"date_formats": {
"month_day_year": "%d. %b %Y",
"weekday": "%A"
}
You can then do the following:
{{ "2022-05-31" | date: format: 'weekday' }}
If you browse your site in English, you will get:
Tuesday
And in German you will get:
Dienstag
This is an accepted solution.
Hi,
Liquid will do that for you, if you use the locale files. E.g.:
In en.default.json you define:
"date_formats": {
"month_day_year": "%b %d, %Y",
"weekday": "%A"
}
And in de.json:
"date_formats": {
"month_day_year": "%d. %b %Y",
"weekday": "%A"
}
You can then do the following:
{{ "2022-05-31" | date: format: 'weekday' }}
If you browse your site in English, you will get:
Tuesday
And in German you will get:
Dienstag
Thank you Stephen! found a way around it, but will keep this one up my sleeve.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025