Plotly.js: Provide proper i18n support

Created on 16 Aug 2016  路  15Comments  路  Source: plotly/plotly.js

Currently Plotly has poor i18n support.

Currently I have to manually patch plotly for each release, which is pretty annoying.

community feature translation

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/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?

All 15 comments

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:

  • Give the PR the label type: translation (that I just created 馃槈 )
  • Please @ mention a few other speakers of this language who can help review your translations. If Plotly staff can't review this language we will wait for comments and approval from someone who can.
  • If you've omitted any keys from dist/translation_keys.txt - which means they will fall back on the US English text - just make a short comment about why in the PR description: the English text works fine in your language, or you would like someone else to help translating those, or whatever the reason.
  • And just to be clear, you need only update the files in 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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

emanuelsetitinger picture emanuelsetitinger  路  3Comments

nicolaskruchten picture nicolaskruchten  路  3Comments

chriddyp picture chriddyp  路  3Comments

jonmmease picture jonmmease  路  3Comments

hashimmoosavi picture hashimmoosavi  路  3Comments