plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.94k stars 1.86k forks source link

Locale Partially Effective: Dictionary Errors in pt-BR, pt-PT, and ko #6256

Open fraupflaume opened 2 years ago

fraupflaume commented 2 years ago

I tried to find an open or closed issue that addresses this and didn't find one. I've been around GitHub, but whether this should be a discussion, pull request, or something else...I'm not all that knowledgeable about where this belongs.

This was brought to my attention through an SO question for the R version, but it's also an issue in Plotly JS. The question is here. The person that asked that question added it to a current issue for that version of Plotly. You can see that here. I realized what was wrong when I compared the language pt-BR to other languages that rendered correctly (de or es, for example).

Wherever dictionary words are rendered with a colon, it is incorrect both in English and the locale language. For example, median: "mediana". This should be "median:":"mediana:" for this to work.

If I've caught them all, these are the English versions that are documented incorrectly (set up for a copy, paste, and regex): 'close',0'high','incoming flow count','kde', 'lat', 'lon','low','lower fence': 'limite inferior','max','mean ± σ','mean','median','min','new text','open','outgoing flow count','q1','q3','source','target','upper fence'

It looks like pt-br, pt-pt, and ko.js have this issue. I just did a find-grep for ',median:'.

This example, using pt-BR (and an example on the Plotly JS site), appears to render correctly, but that's because none of the errors in the JS are shown.

If you look at the tooltips or label with a colon in this CodePen, you'll see the issue.

image

From this CodePen, It should look like this:

image

alexcjohnson commented 2 years ago

Thanks @fraupflaume!

@archmoj perhaps we can write a test that all the keys in all translation dictionaries are valid? If it’s just formatting issues like this we can fix them ourselves, but if it’s more than that we can just delete the broken ones. And then as an informational test have it output a list of missing keys per language? We know some of the older translations will have a bunch of missing keys, but having that collected would be nice so we can post somewhere (perhaps in the community forum) asking for help to update them.