Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate dates #153

Open
PanderMusubi opened this issue Jan 8, 2022 · 8 comments
Open

Translate dates #153

PanderMusubi opened this issue Jan 8, 2022 · 8 comments

Comments

@PanderMusubi
Copy link
Contributor

Please, translate the date shown under a post as they are currently all in English. Reported for version 1.5.0.

@george-gca
Copy link
Collaborator

This currently has to be done manually, as it has to be with any other string. Date formats are very different from each one.

I created a liquid file to help me implement this. You can check it working on the example page of my template.

@untra
Copy link
Owner

untra commented Feb 25, 2024

Liquid date filter doesn't support parsing dates into other languages than english.

https://freakdesign.com.au/blogs/news/translate-a-liquid-date-string-in-shopify

☝️ This blog post describes a way to accomplish this with extra liquid rpogramming. But otherwise this is not something polyglot can help with currently.

If shopify adds further i18n support to their date filter, this can supported better. Unfortunately I can't help further.

@PanderMusubi
Copy link
Contributor Author

The locales support date formats for languages.

@george-gca
Copy link
Collaborator

What do you mean?

@PanderMusubi
Copy link
Contributor Author

Like e.g. Date.0 in https://www.localeplanet.com/icu/nl-NL/index.html

@george-gca
Copy link
Collaborator

Yes, but like @untra said it before:

If shopify adds further i18n support to their date filter, this can supported better. Unfortunately I can't help further.

If you check that link it says:

Converts a timestamp into another date format. The format for this syntax is the same as strftime. The input uses the same format as Ruby’s Time.parse.

Unless Ruby's Time.parse and strftime give support for it, there's nothing he can do.

@jimboolio
Copy link

If I understood the question correctly, there's another plugin for this use case called jekyll-date-localization

With it the following code turns into localized time:

{{ page.date | localize: '%d. %B %Y', site.active_lang }}

Like this for Finnish
image

and same for English
image

@PanderMusubi
Copy link
Contributor Author

I think so, however the period and leading zero are not default in English.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants