plotly / plotly/plotly.py

write_html: locale config does not work

オープン
#2,302 コメント 2 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

packages/python/plotly/plotly/io/_html.py の345行目付近から始め、write_html がスタンドアロンのHTMLとプロット設定をどのように構築するかを追ってください。ドイツ語の locale を使って例を検証し、その後、生成されたドキュメントが locale スクリプトを読み込み、要求された locale をプロット設定に適用することを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, python
領域
data-visualization, web-dev
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。