Currently Plotly has poor i18n support.
axis.tickformat if dates need to be rendered differently because of locale. If you want to keep that feature you have to patch hardcoded format strings: https://github.com/plotly/plotly.js/blob/ad88139911d09b52cfafecc2bc7e72fc267b3a7f/src/plots/cartesian/axes.js#L879Currently I have to manually patch plotly for each release, which is pretty annoying.
Thanks for writing in.
It shouldn't be too hard to pass these locale options in the plot config and have the axes code look up gd._context for their values.
I added a link to a past issue discussing mode bar internationalisation and I marked #380, #288 as duplicate.
:+1: The only thing that keeps us from moving from Highcharts to plotly.js
@sclausen
us
Who would that be?
@etpinard my colleagues and me for one or more of our projects in our company
Hi there,
I've made a fork of Plotly.js to handle french translations and d3 locales for my company:
https://github.com/florianleger/plotly.js
(diff)
I explain in the README how it works and how to add new languages, I thought that it might be helpful to others until a patch came out.
I believe that between #2195 and #2207 this issue on i18n can be closed - but before I do so, I'd love some 馃憤 /馃憥 on the framework from folks who've weighed in here.
I'd also 鉂わ笍 if folks who need localization for their own purposes would be willing to PR those back into the main repo - filling in the translations, verifying the date formats, and adding decimal/thousands to the files in lib/locales. The full list of strings we need to translate is in dist/translation_keys.txt. The locale files we have currently are auto-generated from world-calendars which is itself a descendant of https://github.com/kbwood/calendars - but we're certainly happy to accept any other locales you might want to contribute!
@florianleger thanks for pointing out your fork - I did some things the same way, other things differently, but it was very helpful to see what you had done. Does the current master branch of plotly.js work for your purposes now?
@alexcjohnson My fork does not work with the last release 1.13.2, there is a lot of conflicts and I've not the time to resolve them now...
@florianleger sorry, what I meant was, can you use plotly.js as of the current master branch - which has not yet been published to npm - WITHOUT forking it? I just want to know if the changes in #2195 and #2207 satisfy your needs (and replace your fork) or if there is anything else we need to consider before publishing this.
Thanks for your work! All my needs seems to be solved
I tried to translate it to German, but I'm not sure how to best translate everything. Please feel free do criticize the translation. Do you think we need an issue to discuss the translations for every language?
https://github.com/JonasGutermuth/plotly.js/blob/master/lib/locales/de.js
@JonasGutermuth great!
I think we should handle each translation as a separate PR directly to the main repo:
type: translation (that I just created 馃槈 )lib/locales/, not the ones in dist - those will be automatically updated when we build and publish.@JonasGutermuth That looks great! I'd be happy to review the translations once they've been turned into a pull request (there's a couple of typos "Standart" instead of "Standard" or "Componente" instead of "Komponente").
@alexcjohnson It's fine with the current master, thanks for your work!
I did fill the dictionary for Brazilian Portuguese. I am not used to work with Git. I did clone the repo and tried to push my changes but looks like I have no permission. Should I be a contributor to be able to do that? I can't find any place to ask to be a contributor or any article about how to do that. Can somebody point me a direction? :)
@vinipitta https://help.github.com/articles/fork-a-repo/ is a good place to start. Thanks for your contribution!
Closing. The "to add a translation" instructions are now part of our PR template.
Most helpful comment
I believe that between #2195 and #2207 this issue on i18n can be closed - but before I do so, I'd love some 馃憤 /馃憥 on the framework from folks who've weighed in here.
I'd also 鉂わ笍 if folks who need localization for their own purposes would be willing to PR those back into the main repo - filling in the translations, verifying the date formats, and adding
decimal/thousandsto the files in lib/locales. The full list of strings we need to translate is in dist/translation_keys.txt. The locale files we have currently are auto-generated from world-calendars which is itself a descendant of https://github.com/kbwood/calendars - but we're certainly happy to accept any other locales you might want to contribute!@florianleger thanks for pointing out your fork - I did some things the same way, other things differently, but it was very helpful to see what you had done. Does the current master branch of plotly.js work for your purposes now?