-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
locale for time functions #381
Comments
Hi @aureooms, thanks for logging this issue! Unfortunately right now gomplate just wraps Go's time package, which currently does not support any sort of localization. However, there is a wrapper project https://github.com/goodsign/monday/ which I could add support for specifically translating dates & times. Can I get some more information about your use case? Are you wanting to be able to specify the language/locale in which to format the date, and/or are you wanting to have gomplate respect the |
Well I guess usually you would want a single language per document so environment variables would be perfect. That is my use case. But we are never sure one day someone will want to format dates in different languages in the same document. |
Ok, thanks. Environment variables are easier to support, since they don't involve changing or adding function signatures 😉 |
This issue is stale because it has been open for 60 days with no activity. Remove |
@hairyhenderson this looks pretty cool. https://github.com/goodsign/monday/ looks perfect. I guess it never happened ? |
@gedw99 No, this never got implemented. Can you elaborate on your use-case? |
Same as original Issue maker. The ability to convert Date and Time to different locales formats. But also to convert to and from UTC other users locale time. This is for when you're hitting a DB that holds all data time values in UTC. SO its just converting the values, not the format. Pretty standard stuff for any i18n situation. You typically first need to convert the data, and then convert the format ( for any gui ). Is that clear ? |
Thanks @gedw99. In the very simple case of converting time zones, that's already supported with functions like For converting from UTC to local time you can use Anyway, that brings us back to locale-specific formatting, which is of course not yet supported. I'd be willing to review a PR to add support for it, but I don't have the bandwidth to work on it myself right now. |
Thanks @hairyhenderson I guess I should have looked harder at the docs. Regarding a PR and the local-specific formatting, I guess we first need locale detection as an option, rather than the TZ environment variable. https://github.com/gioui/gio-x/tree/main/pref/locale for example |
Is it currently possible to format dates in, say, French, instead of English?
The text was updated successfully, but these errors were encountered: