-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Make time.Format localized #8797
Comments
Given
That's just a translation of two strings, and I'm not really sure how helpful it would be. Perhaps a better example would be:
|
I think it's great to wrap this in Though I think we'll have to document what those wordings means (WeekdayNarrow, WeekdayShort, WeekdayWide etc...) I couldn't find any examples in the two links shared in this thread. I educated myself: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat |
What if I want to list the Spanish posts on the English site? |
It's an edge case and you should work for it :) People will need to understand that But we could also introduce a way to create a localized date. Maybe
|
@bep You are making my head hurt. |
You, maybe, but why should I work for it.
The above would solve it for all cases without any magic. And it's much simpler to implement and also more efficient. |
As you I mean the users who want to print spanish content on their english pages. I can live with you suggestion and it does improve the way people have dealt with localized date before (data file + i18n) but you will still have to work with several methods to build one date. A simple example to write: Tuesday: February 4 2021 in engish and Mardi: 3 février 2006 in french (I'm not even considering the
I guess what most users would be thrilled about is an easy way to print a localized date similar to |
We could try to make a |
Or we could do |
It's all in the perspective of UX/DX. If you're working with english date you can rely on the page .Date object which sports its own Which means theme creators will need to use systematically that translator method on the site.Language which seems a bit remote. As people are used to using |
@regisphilibert I'm scoping down this particular issue into making |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
https://github.com/go-playground/locales
It looks beautifully complete, and has a lot of the stuff that many people ask about, esp. date formatting:
https://github.com/go-playground/locales/blob/master/rules.go#L45
Not sure how to go about with this (esp. considering go-i18n, but I suspect we can take this in 2 round), but one should be able to do something ala:
Translator ...?
/cc @jmooring @regisphilibert
The text was updated successfully, but these errors were encountered: