plotly / plotly/plotly.py

write_html: locale config does not work

未關閉
#2,302 2 則留言 3 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

bug P3
主要語言
Python
星號
18.8k
分支
2.8k
平均合併
16 小時 26 分鐘
30 天內合併 PR
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. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 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 摘要。