plotly / plotly/react-plotly.js
Localization
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 1.1k
- Forks
- 138
- Ø Merge
- 3 T. 2 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
Hello 👋
I am having trouble with localization.
I have looked at plotly.js tests for some inspiration and I've seen that config.locale and config.locales are being set here and passed to newPlot fn. But it didn't really help me.
My Chart components looks like this:
import * as Plotly from 'plotly.js'
import * as csDictionary from 'plotly.js/lib/locales/cs.js'
import * as React from 'react'
import * as Plot from 'react-plotly.js'
Plotly.register(csDictionary)
Plotly.setPlotConfig({ locale: 'cs' })
const trace1 = {
x: [0, 1, 2],
y: [1, 1, 1],
mode: 'lines+markers+text',
name: 'Lines, Markers and Text',
text: ['Text A', 'Text B', 'Text C'],
textposition: 'top right',
textfont: {
family: 'sans serif',
size: 18,
color: '#1f77b4',
},
type: 'scatter',
}
class Chart extends React.Component {
render() {
return (
<Plot
config={{ locale: 'cs' }}
data={[trace1]}
layout={{
width: 800,
height: 400,
title: 'A Fancy Plot',
}}
/>
)
}
}
export default Chart
❓ Any ideas how to make this work?
Localization is crucial for me and it looks that it is somehow supported, but I just cannot figure how to set it up.
Thanks 🙏
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die im Issue gezeigte Lokalisierungseinrichtung nachzubilden, einschließlich Plotly.register, Plotly.setPlotConfig, config.locale und der React Chart component. Vergleiche das konfigurierte Locale mit dem gerenderten Diagramm und bestimme, welche Änderung erforderlich ist, damit die tschechische Lokalisierung funktioniert; als abgeschlossen gilt die Aufgabe, wenn die lokalisierte UI des Diagramms sichtbar angewendet wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react, typescript
- Bereich
- data-visualization, frontend, internationalization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100