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

formatDate() not returning zh-hans/zh-hant date string #489

Open
HolgerHuo opened this issue Nov 13, 2022 · 3 comments
Open

formatDate() not returning zh-hans/zh-hant date string #489

HolgerHuo opened this issue Nov 13, 2022 · 3 comments

Comments

@HolgerHuo
Copy link

formatDate() function uses Date.prototype.toLocaleDateString() to convert date string, which takes in BCP 47 Language Tags as locale setting. However, locale files are using zh-hans/zh-hant style formatting, causing the theme to unable to translate date strings.

We could either add a layer of translation between zh-hans/zh-hant to zh-cn/zh-hk or update locale jsons; however, the former one isn't very graceful while the latter may result in Breaking change. Maybe there is a better solution to this?

BTW, thanks for creating this theme!

@HolgerHuo
Copy link
Author

Seems that to have all date displayed across the site to be correctly displayed in zh-hans/zh-hant locale, we will have to rename those jsons as Ghost's api can only take zh-cn/zh-hk style formatting.

@eddiesigner
Copy link
Owner

Hi,

The function formatDate() is only used to format the dates in search results when the native search is not enabled, all the rest of dates that are displayed across the pages don't use that function, Ghost handles that.

The locale files also don't handle dates, maybe this is an issue with Ghost itself, I would suggest you to reach their support team to see if they can find a proper solution.

@HolgerHuo
Copy link
Author

Hi! Thanks for your reply.

The function formatDate() is only used to format the dates in search results when the native search is not enabled, all the rest of dates that are displayed across the pages don't use that function, Ghost handles that.

The rest of date locale follows this format for Chinese language: zh-cn/zh-hk. Maybe we should consider renaming the locales files' name to this format too as Ghost use zh-cn/zh-hk to select theme's language.

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

No branches or pull requests

2 participants