d3-scale icon indicating copy to clipboard operation
d3-scale copied to clipboard

i18n for partial date ticks

Open ryanthemanuel opened this issue 4 years ago • 3 comments

We are receiving feedback from our internationalization folks that some of the ticks that we are seeing in graphs are not properly internationalized.

e.g.

US image

French image

The expectation from our internationalization team is that they should be day first and then month. Is that possible? It seems like those representations are all hard coded here: https://github.com/d3/d3-scale/blob/main/src/time.js#L20-L27

ryanthemanuel avatar Jun 07 '21 16:06 ryanthemanuel

@mbostock any thoughts on what could be done to rectify this? We'd be willing to work on a PR to resolve this, but wanted to get a handle on you guys' thoughts about it first.

ryanthemanuel avatar Aug 02 '21 18:08 ryanthemanuel

For now you’ll need to roll your own format as described here: https://github.com/d3/d3-time-format/blob/main/README.md#d3-time-format

Maybe an alternative would be to extend the locale definition in d3-time-format to support the needed shorthands, but my long-term hope is that d3-time-format goes away in favor of JavaScript’s built-in localization (which is already much more capable).

mbostock avatar Aug 02 '21 18:08 mbostock

@mbostock As you said if we extend the locale definition in d3-time-format, can we set our own format from those definitions(not using timeFormat).

AshishMotanamGurunadham avatar Aug 06 '21 21:08 AshishMotanamGurunadham