write_html: locale config does not work
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
Hi!
I'm using plotly to generate a standalone HTML-file that contains only my plot. I do want the axes to be localized in German (one axis has Dates).
This code does not work:
fig.write_html("index.html",
include_plotlyjs="cdn",
config={"locale": "de"}
)
The reason is that the following line is missing in the generated HTML-file (cf. plotly.js documentation)
<script src="https://cdn.plot.ly/plotly-locale-de-latest.js"></script>
I suggest to add a locale argument to the write_html function that does two things (think of de as exchangeable):
- it adds the missing localization file somewhere here
- it adds
"locale": "de"to the plotconfig
Beitragsleitfaden
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 in packages/python/plotly/plotly/io/_html.py ungefähr bei Zeile 345 und verfolge, wie write_html das eigenständige HTML und die Plot-Konfiguration erstellt. Überprüfe das Beispiel mit einem deutschen locale und stelle dann sicher, dass das generierte Dokument das locale-Skript lädt und das angeforderte locale auf die Plot-Konfiguration anwendet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, python
- Bereich
- data-visualization, web-dev
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100